How to Find Document Roots in nginx

April 29, 2017 at 9:39 PMMadestro

You can find document roots using grep. Search in the /etc/nginx/sites-enabled directory to limit the focus to active sites. The -R flag ensures that grep will print both the line with the root directive and the filename in the output:

grep "root" -R /etc/nginx/sites-enabled

The result will look like this, although the names and number of results will vary based on the installation:

 Output

/etc/nginx/sites-enabled/default:       root /var/www/html;

/etc/nginx/sites-enabled/default:       # deny access to .htaccess files, if Apache's document root

/etc/nginx/sites-enabled/default:#      root /var/www/somesite.com;

Posted in: Ubuntu

Tags: ,