Nginx 强制跳转到https
1. 修改nginx配置文件
1 2 | cd /usr/local/nginx/conf/vhost vi www.vermax.cn.conf |
server_name www.vermax.cn vermax.cn; //第5行
后面增加如下命令:
1 | rewrite ^(.*) https://$server_name$1 permanent; //或 rewrite ^(.*) https://www.vermax.cn$1 permanent; |
2. 重启nginx
1 | systemctl restart nginx |