网站首页 > 技术教程 正文
经常性的,系统维护,我们需要配置一个维护页面,以便让用户看到。而同时自己还需要能访问。
也就是说在维护的同时,还需要指定的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 配置文件生成器发布,在线一键生成
你 发表评论:
欢迎- 最近发表
-
- 搞懂linux awk的使用(linux awk $1)
- ZYNQ QSPI flash分区设置&启动配置
- Linux 的 18 个装 B 命令,记得全部搂一遍
- 【Linux】程序执行的黑魔法:五分钟彻底搞懂 Linux ELF 文件
- 聊一聊 Linux 上对函数进行 hook 的两种方式
- 第十二节 Ubuntu 系统 Docker 镜像安装与容器运行指南
- Linux常用场景-VIM文本编辑批量替换
- Linux 下使用 killall 命令终止进程的 8 大用法
- 告别Permission denied!手把手教你玩转Linux文件权限
- [Linux Shell]批量更改文件&文件夹 名大写为小写
- 标签列表
-
- 下划线是什么 (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)
本文暂时没有评论,来添加一个吧(●'◡'●)