Add Domain Name and Index file to Virtual host

Author: Al-mamun Sarkar Date: 2020-04-14 08:00:30

Add Domain Name and Index file to Virtual host. The following codes show how to add a domain to the Nginx configuration file.

 

Edit artofcse.local.conf file and add the following codes:

server {
        listen 80 default_server;
        server_name artofcse.local www.artofcse.local;
        index index.html index.htm index.php;
        root /var/www/artofcse.com;
}

 

Change server_name for live server. It will be your domain name so replace artofcse.local by artofcse.com

server {
        listen 80 default_server;
        server_name artofcse.com www.artofcse.com;
        index index.html index.htm index.php;
        root /var/www/artofcse.com;
}