网站制作学习网Linux→正文:nginx http跳https
字体:

nginx http跳https

Linux 2023/2/23 19:17:37  点击:不统计

http://www.forasp.cn/

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;

网站http://www.制forasp作.cn

·上一篇:设置SSH空闲超时退出时间 >>    ·下一篇:网站监控shell脚本 >>
推荐文章
最新文章