我以前使用过Apache,所以我知道默认的公共web根目录通常是/var/www/。
我最近开始使用nginx,但我似乎找不到默认的公共web根。
我在哪里可以找到nginx的默认公共web根?
我以前使用过Apache,所以我知道默认的公共web根目录通常是/var/www/。
我最近开始使用nginx,但我似乎找不到默认的公共web根。
我在哪里可以找到nginx的默认公共web根?
当前回答
如果你是通过homebrew安装的,并且你使用的是macOS,你可以在/opt/homebrew/Cellar/nginx/1.23.2/html找到它,用你的版本替换1.23.2。
其他回答
nginx的默认web文件夹取决于你如何安装它,但通常它在这些位置:
/usr/local/nginx/html
/usr/nginx/html
'default public web root'可以在nginx -V output中找到:
nginx -V
nginx version: nginx/1.10.1
built with OpenSSL 1.0.2h 3 May 2016
TLS SNI support enabled
configure arguments: --prefix=/var/lib/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/run/nginx/nginx.pid --lock-path=/run/nginx/nginx.lock --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --user=nginx --group=nginx --with-ipv6 --with-file-aio --with-pcre-jit --with-http_dav_module --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_v2_module --with-http_auth_request_module --with-mail --with-mail_ssl_module
前缀值是问题的答案。对于上面的示例,根目录是/var/lib/nginx
你可以访问nginx文件配置,你可以看到root /path。在这个 nginx apache的默认地址是/var/www/html
如果在Ubuntu上使用apt-get安装,请尝试/usr/share/nginx/www.
编辑:
在最近的版本中,路径已更改为: /usr/share/nginx/html
2019编辑:
你也可以试试/var/www/html/index.nginx-debian.html。
对于Ubuntu和docker映像:
/usr/share/nginx/html/