适用于 80端口和443 配置在同一个 server{}内
if ($server_port = 80) {
rewrite ^(.*)$ https://$host$1 permanent;
}
配置示例:
server {
listen 80;
server_name www.22.cn;
rewrite ^ https://$http_host$request_uri? permanent;
}
server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/cacert.pem;
ssl_certificate_key /etc/ssl/privkey.pem;
server_name www.22.cn;
server_tokens off;
location / {
fastcgi_param HTTPS on;
fastcgi_param HTTP_SCHEME https;
}
}
7*24小时在线电话:400-100-2938
7*24小时在线QQ:800811969
Copyright © Yisu Cloud Ltd. All Rights Reserved. 2018 版权所有
粤ICP备17096448号-1 粤公网安备 44010402001142号