weixin_42887519
2018-10-16 08:46 阅读 2.1k

Nginx+php7,为什么根目录的可以打开PHP文件,子目录就没有办法解析php文件,救急~

80

配置文件全部内容如下:
server{
listen 443;
server_name www.11law.cn 11law.cn;
root /home/wwwroot/domain/11law; # 该项要修改为你准备存放相关网页的路径

ssl on;
ssl_certificate           ------------------;
ssl_certificate_key       -----------------;
ssl_session_timeout       5m;
ssl_protocols             TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers               ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA;
ssl_session_cache         shared:SSL:50m;
ssl_prefer_server_ciphers on;
location / {
    index  index.php index.html index.htm;
     #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则

}
#proxy the php scripts to php-fpm
       location ~ \.php$ {

         fastcgi_pass   127.0.0.1:9000;
         fastcgi_index  index.php;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         include        fastcgi_params;
     }




location ^~ /data/runtime {
return 404;
}

location ^~ /application {
return 404;
}

location ^~ /simplewind {
return 404;
}

}

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

相关推荐