Hi guys, i relative new to this but someone can help me configure a ubuntu 20.04 vps with nginx host multiple website please? First i want to configure it to acces ip_adress/website1 and ip_adress/website2 so i can move/duplicate the websites and then to redirect the domain too after i finish configure all. I tryed many tutorials but didn’t manage to get it done. All i have managed to do is to add website accesed when i type the ip. Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi @rober7h,
When you install Nginx you get a default file which loads Nginx on your Droplet’s IP address. This file can be found here:
In order to add two new websites to load like - XXX.XXX.XXX.XXX/website1 and XXX.XXX.XXX.XXX/website2 where XXX.XXX.XXX.XXX is your IP address. First to make sure which is the root folder from which your file is loading files execute the following
You’ll get a result like this:
This means your root folder is /var/www/html. In that folder create the folders for your websites like so:
Now inside those two folders create a simple index.html file like so
The above commands will just add the text ‘Test website1’ or ‘Test website2’ into an index.html file in the location /var/www/html/website[1,2]/index.html.
Now load your websites like so XXX.XXX.XXX.XXX/website1 and XXX.XXX.XXX.XXX/website2 where XXX.XXX.XXX.XXX is your IP address.
That’s it, you are ready to go.
Regards, KFSys
Hi @rober7h,
Once you are done with the testing and you want to make your websites load with different domains, you’ll need to add configuration files for each website in the /etc/nginx/sites-enabled/ folder.
Luckily, DigitalOcean has a pretty great tutorial on how you can do that. You can check that here:
Regards, KFSys