Nginx配置web网站维护页面--->访问任意页面都要跳转到维护页面
2023-09-14 09:15:44 时间
1.网站维护页面背景
网站升级需要停服的情况下,需要准备维护页面,单单准备一个维护页面也是不够的,很多用户会把登陆页面比如login.html收藏,这时访问项目就会出现404,因此还需要配置不管访问什么页面都要跳转到维护页面,可以在Nginx里设置静态页面设置强制跳转
2.具体配置内容
server {
server_name localhost;
listen 80;
location / {
root /data/code/weihutongzhi;
index index.html;
}
if ($request_uri !~ "^/index.html$") {
rewrite ^(.*) http:/urlxxx/index.html permanent;
}
}
server {
listen 443;
server_name localhost;
ssl_certificate xxx.pem;
ssl_certificate_key xxx.key;
location / {
root /data/code/weihutongzhi;
index index.html;
}
if ($request_uri !~ "^/index.html$") {
rewrite ^(.*) https://urlxxx/index.html permanent;
}
}
相关文章
- Nginx配置SSL证书时——nginx:[emerg]unknown directive ssl错误
- 《ASP.NET MVC4 WEB编程》学习笔记------Web API 续
- centos7: iptables保存(配置完nginx的web规则后)
- App.config和Web.config配置文件的配置节点的解析
- Nginx配置文件(nginx.conf)配置详解
- 检查IDEA JRebel 配置是否正确
- eclipse3.4配置的tomcat server如何部署以前的web项目?
- thinkphp3.2在nginx下的配置
- redis的单实例配置+web链接redis
- Web.xml配置详解之context-param
- python-django-celery的安装和配置_20191122
- win7 安装 IIS 配置ASP 【原创】
- Nikto是一款Web安全扫描工具,可以扫描指定主机的web类型,主机名,特定目录,cookie,特定CGI漏洞,XSS漏洞,SQL注入漏洞等,非常强大滴说。。。
- 如何在editplus中配置ctags?
- 玩转华为ENSP模拟器系列 | 配置动态BFD for IS-IS特性示例
- 【Web测试】各类web控件测试点汇总,软测人必备
- FW-1设备配置命令
- 操作系统权限提升(四)之系统错误配置-Tusted Service Paths提权