幫助中心

我們將(jiāng)為您提供完善的幫助文檔,竭誠為您提供最優唱技質的服務!

Nginx自動跳轉到(dào)HTTPS

修改Nginx配置文件

示例一

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;
}
}

以上是否解決了您的問題
  


Copyright © 2006-2022 9557.生生com. All Rights Re技術served. 廈門千雲信息科技有限公司版權所有 常年律師顧問: 西下 福建瀛坤律師事(shì)務所