nginx http强制跳转https
2021-03-20 10:27
标签:cert alt http 自动 info 80端口 cer lis nginx 访问http的时候会自动跳转到https上面。 2.Nginx实现同一端口HTTP跳转HTTPS nginx http强制跳转https 标签:cert alt http 自动 info 80端口 cer lis nginx 原文地址:https://blog.51cto.com/14033037/2488815server {
listen 80;
server_name www.域名.com;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443;
server_name www.域名.com;
root /home/www;
ssl on;
ssl_certificate /etc/nginx/certs/server.crt;
ssl_certificate_key /etc/nginx/certs/server.key;
}
error_page 497 https://$host:$server_port$uri$is_args$args;
下一篇:gin系列-文件上传