久久青草国产成人成人片_风流少妇按摩来高潮_亚洲欧美日韩成人高清在线一区_久久久久久伊人高潮影院_国产一区二区三区精华液_亚洲第一天堂无码专区_精品国产第一国产综合精品_欧美综合自拍亚洲综合图片区

Nginx 自動(dòng)跳轉(zhuǎn)到HTTPS

方法一:

rewrite ^(.*)$ https://$host$1 permanent;


方法二:

適用于 80端口和443 配置在同一個(gè) server{}內(nèi)

if ($server_port = 80) {

rewrite ^(.*)$ https://$host$1 permanent;

}


其他情況, 站點(diǎn)綁定很多域名,只讓某個(gè)域名跳轉(zhuǎn):

set $redirect_https 1;

if ($server_port = 80) {

set $redirect_https "${redirect_https}2";

}

if ($http_host = 'www.22.cn') {

set $redirect_https "${redirect_https}3";

}

if ($http_host = '22.cn') {

set $redirect_https "${redirect_https}3";

}

if ($redirect_https = "123") {

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;

}

}