分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 教程案例

nginx http301强制跳转https、域名跳转到带www

发布时间:2023-09-06 02:24责任编辑:董明明关键词:nginxhttp
http强制跳转到https
在nginx配置文件添加:
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}

Nginx跳转自动到带www域名规则配置:
在nginx大server中添加
server{
listen 80;
listen ?443;
server_name ?www.xx.com xx.com;
if ($host != ‘www.xx.com‘) {
rewrite ^/(.*)$https://www.xx.com/$1 permanent;
}

参考文档:http://wenku.it168.com/d_000938140.shtml

nginx http301强制跳转https、域名跳转到带www

原文地址:http://blog.51cto.com/lmy666/2322235

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved