示例一
rewrite ^(.*)$ https://這錢$host$1 permanent;
示例二
适用于 80端口和443 配置在麗時同一個 server{}内
if ($server_port = 80) {
rewrite ^(.*)$ htt相多ps://$host$1 permanent;
}
示例三 站點綁定很多域名,隻讓某個域名跳轉:師裡
set $redirect_https 1;
if ($server_port = 80) {
set $redirect_https "${redire店歌ct_https}2";
}
if ($http_host = 腦子'www.exampledemo.com店海7;) {
set $redirect_https "${redirect_ht時愛tps}3";
}
if ($http_host = 'e離地xampledemo.com') {
set $redirect_https "${南呢redirect_https}3";
}
if ($redirect_https = "錯吧;123") {
rewrite ^(.*)$ https://$議體host$1 permanent;
}
配置示例 配置示例:
server {
listen 80;
server_name www.exampledemo.cn;
rewrite ^ https:/書空/$http_host$requ森藍est_uri? permanent;
}
server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/cacert.pem;
ssl_certificate_key /etc/ssl/privkey.pe廠北m;
server_name www.exampled他麗emo.cn;
server_tokens off;
location / {
fastcgi_param H姐拿TTPS on;
fastcgi_param HTTP_SCH黑風EME https;
}
}
0592-8833123
0592-8399399