How do i check the default document root for nginx?



  • Note: This also takes into account, if someone has come along and change the default settings.

    First check where the conf directory is:

    $ nginx -V
    

    Look for the --conf-path in the output.

    View the conf file found in the command above.

    $ less /etc/nginx/nginx.conf
    

    At the end of the file there should be an include path:

    include /etc/nginx/conf.d/*.conf;
    

    Change directory to the config directory of the include path:

    $ cd /etc/nginx/conf.d/
    $ less default.conf
    

    The section that says location, should have root setting, that is your document root.

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }
    

Log in to reply
 

© Lightnetics 2024