linux中更改Nginx For Tcp_wrappers返回444
发布时间:2022-06-21 01:01:30 所属栏目:Linux 来源:互联网
导读:前几天通过Tcp_wrappers阻止一些分析出来的恶意IP效果还是有的不过我后面仍发现会占用一些流量,故此我想通过返回444这种非标准的状态码,减小流量的使用. 默认情况下开启模块仅会返回403,代码如下: [root@ipython conf]# curl -I http://www.phpfensi.com H
前几天通过Tcp_wrappers阻止一些分析出来的恶意IP效果还是有的…不过我后面仍发现会占用一些流量,故此我想通过返回444这种非标准的状态码,减小流量的使用. 默认情况下开启模块仅会返回403,代码如下: [root@ipython conf]# curl -I http://www.phpfensi.com HTTP/1.1 403 Forbidden Server: nginx/1.6.1 Date: Fri, 15 Aug 2014 14:52:13 GMT 那么操作起来很简单了,修改源代码即可,我重新打包后的文件会附在本文末尾附件下载,修改方式很简单,return 对应的状态码即可,代码如下: ###重新编译Nginx### [root@ipython nginx-1.6.1]# ./configure --prefix=/software/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-google_perftools_module --with-debug --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre=/root/pcre-8.35 --with-openssl=/root/openssl-1.0.1i --with-zlib=/root/zlib-1.2.8 --add-module=./ngx_tcpwrappers ###具体操作参考前文### [root@ipython nginx-1.6.1]# cp objs/nginx /software/nginx/sbin/ [root@ipython nginx-1.6.1]# make upgrade。 (编辑:淮安站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |