我以前使用过Apache,所以我知道默认的公共web根目录通常是/var/www/。

我最近开始使用nginx,但我似乎找不到默认的公共web根。

我在哪里可以找到nginx的默认公共web根?


当前回答

你可以访问nginx文件配置,你可以看到root /path。在这个 nginx apache的默认地址是/var/www/html

其他回答

在Mac上使用brew安装nginx:

/ usr / local / etc / nginx / nginx上。

location / { 
    root   html;  # **means /usr/local/Cellar/nginx/1.8.0/html and it soft linked to /usr/local/var/www**
    index  index.html;
}  

在ubuntu 19.04中,我们发现它在

/ usr / html / nginx分享

你可以搜索它,不管他们把它移动到哪里(系统管理移动或更新版本的nginx)

找到/ -name nginx

对于AWS EC2 Linux,您将在这里找到:

/usr/share/nginx

Debian上Nginx的默认目录是/var/www/nginx-default。

可以查看“/etc/nginx/sites-enabled/default”文件

并找到

server {
        listen   80 default;
        server_name  localhost;

        access_log  /var/log/nginx/localhost.access.log;

        location / {
                root   /var/www/nginx-default;
                index  index.html index.htm;
        }

根节点是默认位置。