【发布时间】:2018-05-06 20:51:25
【问题描述】:
新的centos7.4 已安装。尚未安装 PHP 或 mySQL。只安装了 NGINX。
'/etc/nginx/nginx.conf' 文件没有被修改。
'/etc/nginx/conf.d/default.conf'是:
server {
listen 80;
server_name public_IP private_IP;
# note that these lines are originally from the "location /" block
root /usr/share/nginx/html;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
但是当我将配置更改为...
...
root /var/www/html;
...
我已经吩咐过了:
sudo chmod -R 755 /var/www
sudo chown -R nginx:nginx /var/wwww
但不起作用。
【问题讨论】:
-
那里有文件吗?
-
是的,我在 /var/www/html、server_ip/*.* 位置有 index.html、test.html 文件,没有任何东西可以访问
-
考虑到这是 CentOS,您可能还想检查 SElinux 权限。试试
ls -alZ /var/www,公共网络内容的上下文应该类似于system_u:object_r:httpd_sys_content_t:s0。
标签: nginx virtualhost centos7