nginx 80端口强制转443

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

server {
listen 443 ssl;
server_name test.com;
}

location / {
rewrite ^ https://\(server_name\)request_uri? permanent;
}

posted @ 2021-02-23 16:27  武兴旺  阅读(1392)  评论(0编辑  收藏  举报