Change Nginx web root documentation directory to New Location on ubuntu 16.04
NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.
On Ubuntu 16.04, by default, the Nginx web server root documentation located in /var/www/html.
Change Nginx web root documentation directory to New Location.In this example we are going to move from /var/www/html to /var/www/data.
If you want to change already existing nginx websites location you need to concentrate on /etc/nginx/sites-enabled directory.
grep "root" -R /etc/nginx/sites-enabled
The above command provides the list of locations where the root directory locations used.You need to make sure you have copied all the data from old location to new location.Once you have all the data copied then you need to edit the file locations you have got from the previous command output.
If you want to change the default nginx web server config file then edit the /etc/nginx/sites-enabled/default file and change the root location to /var/www/data
You can check the nginx config file syntax using the following location
sudo nginx -t
After changing the location you need to restart nginx web server using the following command
sudo systemctl restart nginx