配置某个ip或者页面禁止访问及跳转方法
server
{
listen 80;
server_name www.test.com.cn;
location / {
proxy_redirect off;
proxy_set_header host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://192.168.13.150;
}
# 只能域名访问
if ($host != 'www.test.com.cn') {
return 403;
}
# 访问m_manage.html这个页面自动跳转到首页
if ($request_uri ~* "/login.html"){
#return 403;
rewrite ".*" http://www.test.com.cn;
}
# 访问/?m=3这个页面自动跳转到首页
if ($request_uri ~* "/?m=l"){
return 403;
#rewrite ".*" http://www.test.com.cn;
}
access_log logs/test.access.log;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)