欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

drupal drupal7 d7 nginx + apache php LNMPA中php无法获取$_SERVER['HTTPS'] on 的解决方法 自己亲自做的 有大用 有大大用 有大大大用 有大大大大用

之前介绍过LNMPA配置SSL的方法,但是只是配置了nignx,因为在lnmpa中,nignx做前端,apache做后端,所以导致php无法获取$_SERVER['HTTPS']的值。

下面介绍解决这个问题的办法:

1、在/usr/local/nginx/conf/proxy.conf 最后面加上 proxy_set_header X-Forwarded-Proto $scheme;

2、在对应apache虚拟主机或者httpd.conf 中加入SetEnvIf X-Forwarded-Proto https HTTPS=on 即可传递和接收是否使用的https协议 apache虚拟主机路径为:/usr/local/apache/conf/vhost,找到对应的域名配置文件,建议在虚拟主机里添加



我在 drupal 中的做法是 

1) 在 settings.php 的最后一行加上 $conf['HTTPS'] = TRUE;


2) 在 nginx 的 naproxy.conf 的最后一行 加上:      proxy_set_header   X-Forwarded-Proto $scheme;


3) 在 apache的 虚拟主机文件中 jsfaq.xxxxx.conf 中 的 Directory 中加上  SetEnvIf X-Forwarded-Proto https HTTPS=on

<Directory /www/web/jsfaq_luxshare-ict_com>

    Options FollowSymLinks

    AllowOverride All

    Require all granted

    SetEnvIf X-Forwarded-Proto https HTTPS=on

</Directory>



来自  https://blog.csdn.net/gdali/article/details/60126904



普通分类: