ecstore后台开启了https,nginx也设置了,但是前台res_url还是http的原因

原因在于有些nginx的配置里少了这句话

   fastcgi_param HTTPS $https if_not_empty;
导致ecstore的_SERVER['HTTPS']取值为空,不是On

转自博客 [歪麦博客 - 使用 https,$_SERVER ['HTTPS'] 却不等于 on?][1]

要求:http 和 https 协议共存。

配置 CI con­fig 文件遇到一些问题,因为 PHP 中有根据 $_SERVER ['HTTPS'] 来设置 base_url。

解决方法的办法就是 Ng­inx 配置加上:

fastc­gi_­param HTTPS $https if_not_empty;
完整配置如下:

location ~ .*.(php|php5)?$
{
    try_files $uri =404;
    fastcgi_pass  unix:/tmp/php-cgi.sock;
    fastcgi_param HTTPS $https if_not_empty;
    fastcgi_index index.php;
    include fastcgi_params;
}

注:这个 if_not_empty 额外参数只适合 Ng­inx 1.1.11 之后的版本

原文地址:https://www.cnblogs.com/showker/p/14372338.html