Nignx / PHP环境,访问站点提示k">报错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;
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)