编译Nginx支持Tcp_warppers

Tcp wrappers : Transmission Control Protocol (TCP) Wrappers 为由 inetd 生成的服务提供了增强的安全性。TCP Wrappers 是一种对使用 /etc/inetd.sec 的替换方法。TCP Wrappers 提供防止主机名和主机地址欺骗的保护。欺骗是一种伪装成有效用户或主机以获得对系统进行未经授权的访问的方法。

 

1、重新编译Nginx

[root@ipython nginx-1.6.1]# tar zxf ../ngx_tcpwrappers.tar.gz -C ./ [root@ipython nginx-1.6.1]# sed -i s'#CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g#CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g#' objs/Makefile [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 ####不要make install 哦,编译好即可#### [root@ipython nginx-1.6.1]# make

 

2、完成升级,以及模块的使用,Nginx还是很奇特的哦~~

####备份可执行文件,复制新的文件####
[root@ipython nginx-1.6.1]# mv /software/nginx/sbin/nginx /software/nginx/conf/@nginx [root@ipython nginx-1.6.1]# cp objs/nginx /software/nginx/sbin/ ####测试新版本的Nginx#### [root@ipython nginx-1.6.1]# /software/nginx/sbin/nginx -t nginx: the configuration file /software/nginx/conf/nginx.conf syntax is ok nginx: configuration file /software/nginx/conf/nginx.conf test is successful ###此时没有加入Tcp_wrappers的配置 测试下访问### [root@ipython openssl-1.0.1i]# curl -I http://www.ipython.me HTTP/1.1 200 OK Server: nginx/1.6.1 Date: Mon, 11 Aug 2014 23:08:08 GMT Content-Type: text/html Content-Length: 612 Last-Modified: Mon, 11 Aug 2014 22:45:25 GMT Connection: keep-alive ETag: "53e94785-264" Accept-Ranges: bytes ###平滑升级### [root@ipython nginx-1.6.1]# make upgrade ##测试模块,拒绝1.1.1.30的Nginx请求## ##在http块里加入如下配置## tcpwrappers on; tcpwrappers_daemon nginx; tcpwrappers_thorough off; ##hosts.deny如下## [root@ipython nginx-1.6.1]# awk '!/^#/' /etc/hosts.deny nginx:1.1.1.30 ##重新读取Nginx配置文件## [root@ipython nginx-1.6.1]# /software/nginx/sbin

转载于:https://www.cnblogs.com/i-it/p/3908732.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值