Nginx可以进行IP访问控制,配置指定的IP地址访问服务器网站
今天领导提出一个新的业务需求,网站上线时让外部用户在上线时间段访问到的页面是维护页面,公司内部员工在上线时段可用正常访问公司的网站。
在网上找了相关文档,自己配置了下,结果成功了,线整理了下备以后之用.
修改Nginx的站点配置文件nginx.conf。
在配置文件的sever或者location配置段中进行设置,通allow和deny参数,进行访问控制。例如:
allow 10.10.240.24; 只允许ip10.10.240.24进行访问。
deny all; 拒绝所有的ip访问,这样设置后,就只有ip为10.10.240.24可以访问nginx的网站。拒绝后返回的是403错误,这样报403和404错误时直接返回维护页面内容.
这样是最简单的方法,可能也有考虑不全的地方,有好的方法在发布.
版权属于: 三三世界-百宝箱
本文链接: http://33f.net/build/nginx_limit_ip.html
本文最后更新于2022年04月03日 ,已超过993天没有更新,若内容或图片失效,请留言反馈。
本文允许转载,但请在转载时请以超链接或其它形式标明文章出处
@Doug Shume it's ok for me , you can post here.
Saved as a favorite, I like your website!
If some one wishes to be updated with hottest technologies after that he must be visit this site and be up to date daily.
Heello would you mind sharing which blog platform you're using? I'm planning to start my own blog in the near future but I'm having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then moost blogs and I'm looking for something completely unique. P.S Apologies forr being off-topic butt I had to ask!
Thanks to my father who shared with me regarding this webpage, this website is genuinely amazing.
Hi, I have an overflow of customers that I'd like to send to you but I want to make sure you can handle more leads, let me know if you'd like me to send you more info.
zh.us.to 有效
kms.03k.org 有效
kms.chinancce.com
kms.shuax.com 有效
kms.dwhd.org 有效
kms.luody.info 有效
kms.digiboy.ir 有效
kms.lotro.cc 有效
www.zgbs.cc 有效
cy2617.jios.org 有效
@ 权限问题,试试sudo 再加命令。
你好提示Permission denied 怎么办啊