To set the document root for a PHP application in Nginx, follow these steps:
/etc/nginx/sites-available/[your-site]
.root
directive. This specifies the location of the root directory for the website.root
directive with the path to your PHP application's directory. For example, if your PHP application is located in /var/www/html/myapp
, you would set the root
directive as follows:
root /var/www/html/myapp;
sudo systemctl restart nginx
After these steps, Nginx will use the specified document root directory for your PHP application.