首页 > 系统 > Linux > 正文

linux中编译Nginx支持Tcp_wrappers方法介绍

2022-07-08 12:11:22
字体:
来源:转载
供稿:网友
  linux中编译Nginx支持Tcp_wrappers的配置方法不简单,自己测试了很久没有成功,后来看到此文章后得己解决了,下面整理一下与各位参考.
 
  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]# ./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  --phpfensi.com
  [root@ipython nginx-1.6.1]# sed -i s'#CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror#CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g#' objs/Makefile  
  ####不要make install 哦,编译好即可####
  [root@ipython nginx-1.6.1]# make
  
  2、Tcp_warppers 模块指令:
 
  ###ngx_Tcp_wrappers 配置指令###
 
  1、tcpwrappers_daemon
 
  语法:tcpwrappers_daemon name
 
  默认值:tcpwrappers_daemon nginx
 
  作用域:http,server,location,limit_except
 
  描述:该名字的定义用于在/etc/hosts.[allow|deny]识别

  2、tcpwrappers
 
  语法:tcpwrappers [on|off]
 
  默认值:tcpwrappers off
 
  作用域:http,server,location,limit_except
 
  描述:模块的开关,开启则使用TCP Wrappers 进行访问控制,关闭以避免浪费性能.

  3、tcpwrappers_thorough
 
  语法:tcpwrappers_thorough [on|off]
 
  默认值:tcpwrappers_thorough off
 
  作用域:http,server,location,limit_except
 
  描述:基于hosts.ctl以检查使用IP地址、用户名、反向DNS解析,模块的开发者也未提供详细的使用说明.
 
 

(编辑:错新网)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表