【发布时间】:2018-02-22 01:13:41
【问题描述】:
我在 centos 7 上运行的 nginx 服务器上遇到了这个烦人的 403 禁止错误
你可以自己检查
http://zargold.com
nginx.conf:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name zargold.com;
root /home/zargol/public_html/public;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
#location / {
# try_files $uri $uri/ /index.php;
#}
location ~ \.php$ {
#try_files $uri /index.php =404;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
root /home/zargol/public_html/public;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
我已经为此工作了好几天,它没有得到修复!
注意:我在here 中使用过说明
更新:
现在发生了一件非常奇怪的事情。
我在这个 vps ip 地址上设置了两个域,另一个出现了不同的错误(502 Bad Gateway)
http://zar7.com
【问题讨论】:
-
您检查过文件所有权和权限吗?
-
是的,权限在 777
-
那个根是正确的? (问是因为 zargold/zargol)
-
您评论了
location / { }块,但没有评论内部的try_files,请尝试也将其评论或取消评论整个块 -
@kerbholz 是的,没关系