阿里云SSL部署注意事项(linux):nginx部署ssl服务器502+https访问PHP文件直接下载

阿里云部署ssl基本操作:https://help.aliyun.com/document_detail/98728.html

部署中可能出现的问题:

  1. 服务器安装完SSL,PHP文件无法解析直接下载,html正常解析或访问报502;
    解决方法:在监听的443端口中添加如下代码
    location ~ .*\.php$ {
    root /www/wwwroot/cd.hantwo.cn; ##网站根目录位置
    #fastcgi_pass unix:/tmp/php-cgi-70.sock; ##出现502 报错主要确定这个文件的存储位置在哪
    fastcgi_pass 127.0.0.1:9000; ##开启这个会出现502报错
    try_files $uri /index.php =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
    注:fastcgi_pass 配置方式需根据php-fpm.conf配置监听的模式一样(通信模式一致),不然会报(502);
    **网上一般说开启fastcgi_pass 127.0.0.1:9000;会报502,其实是自身通讯模式不一致导致的;
posted @ 2021-10-27 10:22  PHP小骚年  阅读(353)  评论(0编辑  收藏  举报