我以前使用过Apache,所以我知道默认的公共web根目录通常是/var/www/。
我最近开始使用nginx,但我似乎找不到默认的公共web根。
我在哪里可以找到nginx的默认公共web根?
我以前使用过Apache,所以我知道默认的公共web根目录通常是/var/www/。
我最近开始使用nginx,但我似乎找不到默认的公共web根。
我在哪里可以找到nginx的默认公共web根?
当前回答
查看nginx配置文件来确定。 这个命令是greps在你的机器上配置的任何东西:
cat /etc/nginx/sites-enabled/default |grep "root"
在我的机器上,它是:root /usr/share/nginx/www;
其他回答
导航到文件 $ cat /etc/nginx/nginx.conf
在HTTP——>服务器——>根下的文件中
在这里,您将看到根目录的默认位置和所有错误页面。
查看nginx配置文件来确定。 这个命令是greps在你的机器上配置的任何东西:
cat /etc/nginx/sites-enabled/default |grep "root"
在我的机器上,它是:root /usr/share/nginx/www;
我在Ubuntu上的nginx是“nginx version: nginx/1.9.12 (Ubuntu)” 根路径为/var/www/html/
Ubuntu信息是: 没有LSB模块可用。 分销商ID: Ubuntu 描述:Ubuntu 16.04 LTS 版本:16.04 代号:主客关系的
实际上,如果你只是在Ubuntu上安装了nginx,那么你可以去“/etc/nginx/sites-available”并检查默认文件,有一个类似于“root/ web/root/path/goes/here”的配置。这就是你要找的。
'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)
找到/ -name nginx