linux中更改Nginx For Tcp_wrappers返回444
发布时间:2022-06-21 13:36:37 所属栏目: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。 (编辑:天瑞地安资讯网_瑞安站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 如何运用Tree在 Linux 终端中显示目录树
- Vim 9.0 重大更新,Linux 编辑器使用新的脚本语言
- linux – 如何在shell脚本中操作数组
- linux – 活动套接字的#39;{tcp_error,Socket,etimedout}’
- 调用远程主机上的 RMI 服务时抛出 java.rmi.ConnectExcepti
- Linux大文件重定向与管道的效率是怎样的
- crontab命令行和日志查看
- Linux 5.17引入 RTLA 实时Linux性能分析与追踪工具
- linux – 如何在Google Cloud(Google Compute Engine)上安装
- linux中awk命令使用方法
站长推荐


