How to set the website’s operating directory in nginx?
To set the website root directory for NGINX, you need to follow these steps: 1. Open the NGINX configuration file. By default, this file is located at `/etc/nginx/nginx.conf`. 2. In the configuration file, locate the `server` block, which corresponds to the configuration of a virtual host. If you only have one website, there may only be one `server` block. 3. Within the `server` block, find the `root` directive and set its value to the desired path for the website root directory. For example, if you want to place website files in the `/var/www/example.com` directory, you can set `root` to `root /var/www/example.com;`. 4. Save and close the configuration file. Then reload the NGINX configuration for the changes to take effect. You can use the following command to reload the configuration: `sudo systemctl reload nginx`. 5. Ensure that your website files are located in the specified directory and have the correct permissions. Once you have completed these steps, your website will use the set directory as its root directory.