php 判断https,无法判断是否 https 请求

本文探讨了在将网站从HTTP升级到HTTPS过程中,遇到$_SERVER变量中'REQUEST_SCHEME'仍显示为http的问题。作者分享了nginx配置并寻求解答,重点在于理解为什么在SSL启用情况下,HTTP请求头未正确更新。
摘要由CSDN通过智能技术生成

http 网站升级 https

在 https 状态下打印 $_SERVER

["REQUEST_SCHEME"] => string(4) "http"

["SERVER_PROTOCOL"] => string(8) "HTTP/1.0"

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

0ecd13c148dfdd526b44e75238072bbc.png

先谢谢大家回答,我的 $_server 全部都没有标识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;

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值