使用Nginx设置https时无法打开index.php网站

时间:2018-08-29 02:58:42

标签: php nginx

我在centos服务器上使用nginx + php-fpm,并且在尝试设置https并修改nginx.conf时,我发现只有'index.php'无法正确访问。

工作:

https://ip/index.php

https://domain/*.php(*!=索引)

https://domain/*/*.php

http://ip/index.php

http://domain/index.php

不起作用:

https://domain/index.php

我的nginx.conf看起来像这样:

server {
listen 443 default_server;
server_name localhost;
ssl on;
root /home/wwwroot/default;
index index.html index.htm;
ssl_certificate   cert/*****.pem;
ssl_certificate_key  cert/*****.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
    root /home/wwwroot/default;
    index index.html index.htm index.php;
}
location ~ [^/]\.php(/|$) {
    root           /home/wwwroot/default;
    fastcgi_pass  unix:/tmp/php-cgi.sock;
    fastcgi_index  index.php;
    fastcgi_param  HTTPS   on;
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    include        fastcgi_params;
    include fastcgi.conf;
    }
}

0 个答案:

没有答案