php 获取当前访问URL的协议

<?php $slhttp = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
echo $slhttp;
?>

 

nginx proxy-pass-php.conf 配置

location @apache

{

internal;

proxy_pass http://127.0.0.1:88;

proxy_set_header X-Forwarded-Proto $scheme;

incldue proxy.conf;

}

location ~ [^/]\.php(/|$)

{

proxy_set_header X-Forwarded-Proto $scheme;

}

 

posted @ 2018-11-20 15:41  codeforu2  阅读(4456)  评论(0编辑  收藏  举报