nginx http跳https
nginx 配置 http 跳转https
如果是跳转本域名,参考如下 ,直接将 *.forasp.cn 修改为自己的域名
server
{
listen 80;
server_name *.forasp.cn;
rewrite ^(.*)$ https://$host$1 permanent;
}
http跳转https不同域名,比如www.newdomain.com
server
{
listen 80;
server_name *.forasp.cn;
rewrite ^(.*)$ https://www.newdomain.com/$1 permanent;
}
上面是会带着uri 对应参数,如果不带参数,则 将¥1去掉
rewrite ^(.*)$ https://www.newdomain.com permanent;