NGinx Default public www location?

前端 未结 30 1102
野性不改
野性不改 2020-11-28 17:51

I have worked with Apache before, so I am aware that the default public web root is typically /var/www/.

I recently started working with nginx, but I ca

30条回答
  •  庸人自扰
    2020-11-28 17:51

    Dump the configuration:

    $ nginx -T
    ...
    server {
        ...
        location / {
            root   /usr/share/nginx/html;
            ...
        }
        ...
    }
    

    What you get might be different since it depends on how your nginx was configured/installed.

    References:

    • -T option on the man page

    • -T option in the help message

    Update: There's some confusion on the issue of if/when the -T option was added to nginx. It was documented in the man page by vl-homutov on 2015 June 16, which became part of the v1.9.2 release. It's even mentioned in the release notes. The -T option has been present in every nginx release since, including the one available on Ubuntu 16.04.1 LTS:

    root@23cc8e58640e:/# nginx -h    
    nginx version: nginx/1.10.0 (Ubuntu)
    Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
    
    Options:
      -?,-h         : this help
      -v            : show version and exit
      -V            : show version and configure options then exit
      -t            : test configuration and exit
      -T            : test configuration, dump it and exit
      -q            : suppress non-error messages during configuration testing
      -s signal     : send signal to a master process: stop, quit, reopen, reload
      -p prefix     : set prefix path (default: /usr/share/nginx/)
      -c filename   : set configuration file (default: /etc/nginx/nginx.conf)
      -g directives : set global directives out of configuration file
    

提交回复
热议问题