实在找不到解决方法了,google就那一篇文章在好几个地方也不知道谁抄的谁的,关键你抄袭就罢了管用也行啊还不管用
感觉我遇到的和这个问题里的答案是一样的:
https://segmentfault.com/q/10...
但是这个问题有答主说和ssl无关,那么我访问http的1.php(正常访问)和https的1.php(直接下载)分别如下:
我又访问其他php文件http正常打开:
https直接下载:
环境是amh4.2的nginx,证书是在腾讯云申请的DV证书,nginx.conf的ssl配置如下:
server { listen 443; server_name www.w00yun.top; ssl on; ssl_certificate 1_www.w00yun.top_bundle.crt; ssl_certificate_key 2_www.w00yun.top.key; ssl_session_timeout 5m; ssl_protocols TLSv1; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { root /home/wwwroot/w00yun.top/web; index index.html index.htm; } }
把ssl配置改为
server { listen 443; server_name www.w00yun.top; ssl on; ssl_certificate 1_www.w00yun.top_bundle.crt; ssl_certificate_key 2_www.w00yun.top.key; ssl_session_timeout 5m; ssl_protocols TLSv1; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { root /home/wwwroot/w00yun.top/web; index index.html index.htm index.php; } location ~ .*\.php$ { fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } }
https访问1.php(phpinfo)由下载变成了如下:
但是访问之前的index.php还是直接下载:
想问一下到底是哪里的原因呢?
补充:原来amh面板有单独的域名配置文件,通过修改域名配置文件如下:
listen 443; ssl on; ssl_certificate /usr/local/nginx/conf/1_www.w00yun.top_bundle.crt; ssl_certificate_key /usr/local/nginx/conf/2_www.w00yun.top.key; set $subdomain ''; root /home/wwwroot/w00yun.top/web$subdomain; include rewrite/amh.conf; #rewrite end #error_page error_page 400 /ErrorPages/400.html; error_page 403 /ErrorPages/403.html; error_page 404 /ErrorPages/404.html; error_page 502 /ErrorPages/502.html; location ~ /ErrorPages/(400|401|403|404|405|502|503)\.html$ { root /home/wwwroot/w00yun.top/web; } location ~ .*\.php$ { fastcgi_pass unix:/tmp/php-cgi-w00yun.top.sock; fastcgi_index index.php; include fcgi-host.conf; fastcgi_param DOCUMENT_ROOT /web$subdomain; fastcgi_param SCRIPT_FILENAME /web$subdomain$fastcgi_script_name; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp3|wma)$ { expires 30d; } location ~ .*\.(js|css)$ { expires 12h; }
已经可以访问部分php文件(自写PHP页面)和phpinfo了:
也可以直接访问url不添加index.php,但是丢失JS和CSS样式:
原有页面应该是这样的:
直接访问url加上index.php仍然会直接下载: