鍍金池/ 問(wèn)答/PHP  HTML/ 無(wú)法判斷是否 https 請(qǐng)求

無(wú)法判斷是否 https 請(qǐng)求

http 網(wǎng)站升級(jí) https 
在 https 狀態(tài)下打印 $_SERVER
  ["REQUEST_SCHEME"] => string(4) "http"
  ["SERVER_PROTOCOL"] => string(8) "HTTP/1.0"

等信息全是http,這是什么原因??

 

clipboard.png

先謝謝大家回答,我的 $_server 全部都沒(méi)有標(biāo)識(shí)https;附上我的nginx 配置

server {
        listen       80;
        root /www;
        server_name xx.com;
        rewrite ^(.*)$  https://$host$1 permanent;
        index  index.html index.php index.htm;
        location ~ \.php$ {
                proxy_pass http://127.0.0.1:88;
                include naproxy.conf;
        }
        location ~ /\.ht {
                deny  all;
        }
        location / {
                try_files $uri @apache;
        }
        location @apache {
                 internal;
                 proxy_pass http://127.0.0.1:88;
                 include naproxy.conf;
        }
}

server {
        listen       443;
        root /www;
        ssl                  on;
        ssl_certificate      cert/xx.com.crt;
        ssl_certificate_key  cert/xx.com.key;
        ssl_prefer_server_ciphers on;
        ssl_session_timeout 10m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        server_name xx.com;
        index  index.html index.php index.htm;
        location ~ \.php$ {
                proxy_pass http://127.0.0.1:88;
                include naproxy.conf;
        }
        location ~ /\.ht {
                deny  all;
        }
        location / {
                try_files $uri @apache;
        }
        location @apache {
                 internal;
                 proxy_pass http://127.0.0.1:88;
                 include naproxy.conf;
        }
}

回答
編輯回答
情已空

$_SERVER ['HTTP_X_FORWARDED_PROTO']

2018年3月23日 03:56
編輯回答
墨小白

$_SERVER['HTTPS']

$_SERVER['SERVER_PORT'] == 443

2017年12月5日 08:48
編輯回答
乖乖噠

isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == "on")
找找這2個(gè)有嗎,我用這2個(gè)判斷的,ok的

2017年10月3日 15:40
編輯回答
壞脾滊

nginx fastcgi參數(shù)設(shè)置了嗎

2017年7月22日 08:17
編輯回答
巷尾

你訪問(wèn)的這個(gè)地址,到達(dá)的第一個(gè) WEB 服務(wù)器(處理了你這個(gè) HTTPS 的請(qǐng)求的那個(gè)),與你在頁(yè)面中看到的那個(gè) php 服務(wù)器,又不一定是同一個(gè)東西。

2017年7月4日 13:39
編輯回答
柒喵

后臺(tái)有代理轉(zhuǎn)發(fā)么?
如果有轉(zhuǎn)發(fā),一般內(nèi)網(wǎng)轉(zhuǎn)發(fā),會(huì)用 http


注意 nginx 中的配置:

clipboard.png

有內(nèi)部轉(zhuǎn)發(fā)

2017年1月25日 03:12