网站首页 > 技术教程 正文
经常性的,系统维护,我们需要配置一个维护页面,以便让用户看到。而同时自己还需要能访问。
也就是说在维护的同时,还需要指定的IP能访问。
以下就是一个nginx配置维护页面的例子:
其中:
/weihu/是维护页面的URL,应该在/data/www下建一个weihu的目录,把维护页面index.html放到这个目录内.
103.214.84.224|101.231.194.4|180.168.251.235为允许访问的IP地址。
最终效果:当用户访问真实的URL时,会显示跳转至/weihu/
详细配置如下:
location /weihu/ { root /data/www/; index index.html weihu.html logo.png upgrade.png; access_log /data/log/nginx/tx.log ha; } set $weihu 1; if ($http_x_forwarded_for ~* "103\.214\.84\.224|101\.231\.194\.4|180\.168\.251\.235") { set $weihu 0; } if ($document_uri ~* "/weihu") { set $weihu 0; } if ($weihu = "1") { rewrite .* /weihu/ redirect; }
猜你喜欢
- 2024-10-15 web网站性能优化:nginx开启GZIP压缩网页,JS,CSS
- 2024-10-15 15、Nginx-网页压缩传输(nginx转发文件流)
- 2024-10-15 nginx实现公告维护页面(nginx 状态信息)
- 2024-10-15 网页版 Nginx 配置文件生成器发布,在线一键生成
你 发表评论:
欢迎- 08-06linux 和 windows文件格式互相转换
- 08-06谷歌 ChromeOS 已支持 7z、iso、tar 文件格式
- 08-06Linux下比较文件内容的6种方法
- 08-06文件格式及功能汇总
- 08-0610个Linux文件内容查看命令的实用示例
- 08-06Linux-如何区分不同文件类型
- 08-06Zabbix技术分享——监控windows进程资源使用情况
- 08-06Linux系统卡顿?学会ps命令这三招,轻松定位问题进程
- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)