nginx默认走https/自动跳转到https
8 年 ago jony nginx默认走https/自动跳转到https已关闭评论
server {
listen 80;
listen 443 ssl;
server_name www.xxxx.net;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_certificate /etc/nginx/ssl/www.xxxx.net.crt;
ssl_certificate_key /etc/nginx/ssl/www.xxxx.net.key;
ssl_prefer_server_ciphers on;
#自动跳转到HTTPS (可选)
if ($server_port = 80) {
rewrite ^(.*)$ https://$host$1 permanent;
}
location / {
root /data/xxxx;
index index.html index.htm index.php;
}
}
https://www.getssl.cn/support/nginx-%E8%87%AA%E5%8A%A8%E8%B7%B3%E8%BD%AC%E5%88%B0https/