How to set up website directories in nginx
To set up the NGINX website directory, you must edit the NGINX configuration file.
First, locate the configuration file for NGINX, which is typically found in the /etc/nginx directory. The main configuration file is nginx.conf, but there is usually a sites-available directory that contains configuration files for each website.
- Open the nginx.conf file or the necessary website configuration file.
- Locate the server block, which is where the website is defined. Inside the block, find the root directive, which defines the website’s root directory.
- for example: root directory is located at /var/www/html;
- Change the path of /var/www/html to the directory path of the website you want to set up.
- Save and close the configuration file.
- Restart the NGINX service to apply the changes.
- For example, you can restart the NGINX service using the following command: sudo service nginx restart.
Your NGINX website directory should now be configured. Please make sure you have the necessary permissions to access and modify the website directory that has been set up.