Nginx 重定向 443


 

server { 

listen 443 ssl;
server_name www.xxx.com xxx.com;
ssl_certificate keys/xxxx_ssl.pem;
ssl_certificate_key keys/xxxx_ssl.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#啟用TLS1.1、TLS1.2要求OpenSSL1.0.1及以上版本,若您的OpenSSL版本低於要求,請使用 ssl_protocols TLSv1;
ssl_ciphers HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM;
ssl_prefer_server_ciphers on;

location ~ / {
proxy_pass http://192.168.1.222; #后端 真實服務器
index index.html index.htm A1-index.html;

}
}

server {
listen 80;
server_name www.xxx.com xxx.com;
rewrite ^(.*) https://$host$1 permanent;
}


想讓別人訪問http://重定向https://,就在訪問http的server{}里填寫
rewrite ^(.*) https://$host$1 permanent;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM