简单修改nginx的配置,限制指定IP访问指定页面
一个客户的需求,看了很多的教程,实现方式都不一样,现将我自己配置的分享给大家。1.修改nginx配置文件(路径/usr/local/openrestry/nginx/conf/nginx.conf)vim /usr/local/openrestry/nginx/conf/nginx.conf)#添加IP至allow(例如我们将10.208.96.192和10.208.96.193加入)locati
·
一个客户的需求,看了很多的教程,实现方式都不一样,现将我自己配置的分享给大家。
1.修改nginx配置文件
(路径/usr/local/openrestry/nginx/conf/nginx.conf)
vim /usr/local/openrestry/nginx/conf/nginx.conf)
#添加IP至allow(例如我们将10.208.96.192和10.208.96.193加入)
location = /index.html
{ allow 10.208.96.192;
allow 10.208.96.193;
deny all;
root /work/weichuangli;
}
2.关闭并重启nginx服务
#关闭nginx服务
/usr/local/openrestry/nginx/sbin/nginx -s stop
#启动nginx服务
/usr/local/openrestry/nginx/sbin/nginx -c /usr/local/openrestry/nginx/conf/nginx.conf
#重新载入nginx配置
/usr/local/openrestry/nginx/sbin/nginx -s reload
更多推荐
已为社区贡献2条内容
所有评论(0)