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

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

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


当前回答

在ubuntu 19.04中,我们发现它在

/ usr / html / nginx分享

其他回答

如果你是通过homebrew安装的,并且你使用的是macOS,你可以在/opt/homebrew/Cellar/nginx/1.23.2/html找到它,用你的版本替换1.23.2。

如果在Ubuntu上使用apt-get安装,请尝试/usr/share/nginx/www.

编辑:

在最近的版本中,路径已更改为: /usr/share/nginx/html

2019编辑:

你也可以试试/var/www/html/index.nginx-debian.html。

在Mac OS X上,使用brew安装nginx会使默认目录:

/usr/local/var/www

So:

root html

意味着

root /usr/local/var/www/html

没有html目录,所以必须手动创建。

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

/usr/share/nginx

在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;
}