碰到了一个奇怪的小白问题,通过如下配置在nginx上配置ssl后,用https访问主页的话,浏览器直接下载index.php,而不是载入index.php,nginx启动无报错还请各位高手指教,多谢。
server { root /var/www/html; index index.html index.htm index.php; listen 443; server_name localhost; ssl on; ssl_certificate a.crt; ssl_certificate_key a.key; ssl_session_timeout 10m; ssl_session_cache shared:ssl:10m; ssl_protocols tlsv1 tlsv1.1 tlsv1.2; ssl_ciphers all:!adh:!export56:rc4+rsa:+high:+medium:+exp; ssl_prefer_server_ciphers on; }
回复内容: 碰到了一个奇怪的小白问题,通过如下配置在nginx上配置ssl后,用https访问主页的话,浏览器直接下载index.php,而不是载入index.php,nginx启动无报错还请各位高手指教,多谢。
server { root /var/www/html; index index.html index.htm index.php; listen 443; server_name localhost; ssl on; ssl_certificate a.crt; ssl_certificate_key a.key; ssl_session_timeout 10m; ssl_session_cache shared:ssl:10m; ssl_protocols tlsv1 tlsv1.1 tlsv1.2; ssl_ciphers all:!adh:!export56:rc4+rsa:+high:+medium:+exp; ssl_prefer_server_ciphers on; }
和 ssl 没有关系,请确认:
这个请求的确匹配到了这个 server 而不是别的这个 server 的配置的其他部分指明了如何处理 .php 文件(发往 php-fpm)
继续顶。。。
你的程序遇到https://xxx.com/111.html是可以的访问的(不考虑伪静态)
但访问.php后缀却无法正确执行
说明你的nginx与php没有关联
我对你们在网上回答的答案感到很疑惑,你们确定遇到这个问题吗?
我把vps关闭了快4个小时,然后开网站一样会下载index.php。更别说是因为ssl还是https还是php还是nginx了,我恢复以前的正常快照一样会碰到这个问题。
ipconfig /flushdns 重启电脑、手机3g访问,一样会下载这玩意,我就纳闷了,cdn缓存这么久都不失效。。。
