Hosting multiple websites on a single web server is called a virtual host. But in Nginx, the concept is called Server blocks that use the server_name and listen to directives to bind to TCP sockets. Also in certain scenarios, if you don’t want to edit the default Nginx files you can set up a virtual host to avoid editing the default configuration file.
A visual explanation of the virtual host is given below in the image:
Map ubuntu server public IP to the domain name’s DNS.
Check out this tutorial, to link (map) your newly purchased domain name with the ubuntu server.
Check out this tutorial, to install Nginx on Ubuntu.
Create a new file with your domain name under /etc/nginx/sites-available
Add the following content to the file, this
Note:* Change <Domain_Name> with your domain name (for example: iternerays.com)
The sample domain configuration file link given below.
Create a symbolic link from sites-available to sites-enabled
After executing the command a symbolic link will be created. An example output screenshot is given below:
Create a directory under /var/www with the domain name.
Navigate to the domain directory created above step.
Create index.html under your domain directory (i.e /var/www/<Domain_Name>)
check your browser, by visiting your domain name (for example: iternerays.com ). The reference output screenshot is given below.