nginx报错:access forbidden by rule

Nignx / PHP环境,访问站点提示报错access forbidden by rule
检查nginx配置文件,找到如下内容注释掉
##
#注释
#location ~ ^.+\.php {
# deny all; #这里引起的
# }
完整配置文件示例如下:
server
{
listen 80;
server_name khh2.com;
root /home/wwwroot/khh2/admin/www/;
access_log /var/log/nginx/khh2/admin.access.log;
error_log /var/log/nginx/khh2/admin.error.log;
location / {
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php$1 last;
break;
}
}
location ~ \.php(.*)$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
include fastcgi.conf;
}
##
#注释:
#location ~ ^.+\.php {
# deny all;
# }
}
location ~ ^/(image|javascript|css|flash|media|static|jpeg|png|js)/ {
expires 1h;
}
版权声明:本文为下一朵云发布文章,转载请附上原文出处链接和本声明。
本文链接:https://www.orcy.net.cn/1561.html
~ 广告:HCIE-Security认证课程辅导资料(付费)
本文链接:https://www.orcy.net.cn/1561.html
~ 广告:HCIE-Security认证课程辅导资料(付费)
发表评论