我有 Nginx 设置和显示测试页面正确。如果尝试更改根路径,将得到一个403禁止错误,尽管所有权限都是相同的。另外,nginx 用户存在。
Nginx.conf:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
index index.html index.htm;
server {
listen 80;
server_name localhost;
root /var/www/html; #changed from the default /usr/share/nginx/html
}
}
Namei-om/usr/share/nginx/html/index.html
f: /usr/share/nginx/html/index.html
dr-xr-xr-x root root /
drwxr-xr-x root root usr
drwxr-xr-x root root share
drwxr-xr-x root root nginx
drwxr-xr-x root root html
-rw-r--r-- root root index.html
Namei-om/var/www/html/index.html
f: /var/www/html/index.html
dr-xr-xr-x root root /
drwxr-xr-x root root var
drwxr-xr-x root root www
drwxr-xr-x root root html
-rw-r--r-- root root index.html
错误日志
2014/03/2312:45:08[ error ]5490 # 0: * 13 open () “/var/www/html/index.html”失败(13: 拒绝许可) ,客户端: XXX.XX.XXX.XXX,服务器: localhost,请求: “ GET/index.html HTTP/1.1”,主机: “ ec2-xxx-xx-xxx-xxx.compute-1.amazonaws.com”