原因在于有些nginx的配置里少了这句话
fastcgi_param HTTPS $https if_not_empty;
导致ecstore的_SERVER['HTTPS']取值为空,不是On
转自博客 [歪麦博客 - 使用 https,$_SERVER ['HTTPS'] 却不等于 on?][1]
要求:http 和 https 协议共存。
配置 CI config 文件遇到一些问题,因为 PHP 中有根据 $_SERVER ['HTTPS'] 来设置 base_url。
解决方法的办法就是 Nginx 配置加上:
fastcgi_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 额外参数只适合 Nginx 1.1.11 之后的版本