Would you like to learn how to install Nginx and configure multiple Websites on a computer running Ubuntu Linux? In this tutorial, we are going to show you how to use the Virtualhost feature to configure multiple Websites on the same Nginx server.
Nginx calls Virtualhosts the SERVER BLOCKS feature.
• Ubuntu 18
• Ubuntu 19
• Ubuntu 20
• Nginx 1.18.0
In our example, the IP address of the Nginx server is 36.160.86.106.
In our example, the Nginx server is hosting the website WWW.GAMEKING.TIPS.
Equipment list
The following section presents the list of equipment used to create this tutorial.
As an Amazon Associate, I earn from qualifying purchases.
Nginx – Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Nginx.
Nginx Virtualhost – DNS configuration
Access the GODADDY website and purchase a DNS domain.
In our example, we purchased a domain named:
You can use any website to purchase a DNS domain, GoDaddy is just my personal choice.
Create a DNS entry pointing your website to the computer running Nginx.
In our example, we created a DNS entry pointing WWW.GAMEKING.TIPS to 35.160.86.106.
Use the NSLOOKUP command to test your DNS configuration.
Here is the command output.
Congratulations! You have finished the required DNS configuration.
Tutorial Nginx Virtualhost – Multiple Websites on the same server
Install the Nginx server.
Create a directory to store the new website files.
The website files will be stored inside the following directory:
Create an Nginx configuration file for the new website.
Here is the file with our configuration.
Create a symbolic link to enable the Nginx virtual host configuration.
Restart the Nginx service.
Create a test page inside the new website directory.
Here is the file content.
Open your browser and try to access the virtual website.
In our example, the following URL was entered in the Browser:
• http://www.gameking.tips
Congratulation! You finished the Server Blocks configuration of Nginx.