我以前使用过Apache,所以我知道默认的公共web根目录通常是/var/www/。
我最近开始使用nginx,但我似乎找不到默认的公共web根。
我在哪里可以找到nginx的默认公共web根?
我以前使用过Apache,所以我知道默认的公共web根目录通常是/var/www/。
我最近开始使用nginx,但我似乎找不到默认的公共web根。
我在哪里可以找到nginx的默认公共web根?
当前回答
nginx的默认web文件夹取决于你如何安装它,但通常它在这些位置:
/usr/local/nginx/html
/usr/nginx/html
其他回答
对于Ubuntu和docker映像:
/usr/share/nginx/html/
在ubuntu 19.04中,我们发现它在
/ usr / html / nginx分享
我在Digital Ocean用nginx运行WordPress网站时也遇到了这个问题。
我的解决方案如下:
修改/etc/nginx/nginx.conf文件如下:
server {
root /var/www/html;
}
然后我必须sudo服务nginx重启
nginx -V命令也显示你的nginx配置文件的位置(我的是指向/etc/nginx/nginx.conf)
Alpine Linux根本没有任何默认位置。文件/etc/nginx/conf.d/default.conf说:
# Everything is a 404
location / {
return 404;
}
# You may need this to prevent return 404 recursion.
location = /404.html {
internal;
}
替换成像root /var/www/localhost/htdocs这样的一行来指向你想要的目录。然后sudo service nginx restart重新启动。
导航到文件 $ cat /etc/nginx/nginx.conf
在HTTP——>服务器——>根下的文件中
在这里,您将看到根目录的默认位置和所有错误页面。