网站首页 > 技术教程 正文
经常性的,系统维护,我们需要配置一个维护页面,以便让用户看到。而同时自己还需要能访问。
也就是说在维护的同时,还需要指定的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 配置文件生成器发布,在线一键生成
欢迎 你 发表评论:
- 12-17软件商店最新版本(应用软件下载安装)
- 12-17低级格式化工具哪个好用(低级格式化的功能)
- 12-17电脑没有压缩包功能了怎么回事
- 12-17电脑声音小怎么调大点快捷键
- 12-17键盘的win键在什么地方(键盘上的windows键在哪)
- 12-17云服务器怎么使用(腾讯云服务器怎么使用)
- 12-17win11资源管理器在哪(win11资源管理器在哪里)
- 12-17win10重装工具(win10重装程序)
- 最近发表
- 标签列表
-
- 下划线是什么 (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)

本文暂时没有评论,来添加一个吧(●'◡'●)