NGINX白名单配置
设置allow、deny
参数,也可作用于TCP和UDP代理:
allow 114.114.114.114;
deny all;
配置/etc/sysconfig/iptables
-A INPUT -s 114.114.114.114 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
配置/etc/nginx/nginx.conf
if ($remote_addr !~ ^(114.114.114.114 |114.114.114.115)) { rewrite ^.*$ /403.jsp last; }
设置$http_x_forwarded_for
参数
if ($http_x_forwarded_for !~ ^(114.114.114.114 |114.114.114.115)) { rewrite ^.*$ /maintence.php last; }