https访问php下载,amh面板nginx配置https后访问PHP文件直接下载

实在找不到解决方法了,google就那一篇文章在好几个地方也不知道谁抄的谁的,关键你抄袭就罢了管用也行啊还不管用:

77e60694bcf5471d695e4251882ca57b.png

但是这个问题有答主说和ssl无关,那么我访问http的1.php(正常访问)和https的1.php(直接下载)分别如下:

ece267c00f251aec4712260a7da6cad5.png

f455c56ecb384e48432efc9e1cf5aeb1.png

我又访问其他php文件http正常打开:

258387f5190b0ba5ca04d82fc80a0c49.png

https直接下载:

7673036c665907c62d3d48b2515e4832.png

环境是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)由下载变成了如下:

56b9c162c66443d4c2df0ac5939d1279.png

但是访问之前的index.php还是直接下载:

bce2b999eab3ad10c46a48f09dba8d1f.png

想问一下到底是哪里的原因呢?

补充:

原来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了:

ed1b8de57326924ce38e044e31bf8ada.png

也可以直接访问url不添加index.php,但是丢失JS和CSS样式:

997372ea2d4ac55a12d862ed76dff474.png

原有页面应该是这样的:

53bec5f6ddda726a90a1b489b7e4bbbc.png

直接访问url加上index.php仍然会直接下载:

2db5b4e7eafa648f10a534801b7ec04a.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值