国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

linux中編譯Nginx支持Tcp_wrappers方法分享

2024-08-27 23:55:38
字體:
來源:轉載
供稿:網友
  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、完成升級,以及模塊的使用,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.111cn.net
  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/nginx -s reload
  ###此時訪問 就是403了###
  [root@itchenyi ~]# curl -I http://www.111cn.net
  HTTP/1.1 403 Forbidden
  Server: nginx/1.6.1
  Date: Mon, 11 Aug 2014 23:12:47 GMT
  Content-Type: text/html
  Content-Length: 168
  Connection: keep-alive
  3、Tcp_warppers 模塊指令:
 
  ###ngx_Tcp_wrappers 配置指令###
 
  1、tcpwrappers
 
  語法:tcpwrappers [on|off]
 
  默認值:tcpwrappers off
 
  作用域:http,server,location,limit_except
 
  描述:模塊的開關,開啟則使用TCP Wrappers 進行訪問控制,關閉以避免浪費性能.
 
  2、tcpwrappers_daemon
 
  語法:tcpwrappers_daemon name
 
  默認值:tcpwrappers_daemon nginx
 
  作用域:http,server,location,limit_except
 
  描述:該名字的定義用于在/etc/hosts.[allow|deny]識別
 
  3、tcpwrappers_thorough
 
  語法:tcpwrappers_thorough [on|off]
 
  默認值:tcpwrappers_thorough off
 
  作用域:http,server,location,limit_except
 
  描述:基于hosts.ctl以檢查使用IP地址、用戶名、反向DNS解析,模塊的開發者也未提供詳細的使用說明.
 
 

(編輯:武林網)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 绥滨县| 富宁县| 崇义县| 巴南区| 长武县| 铜梁县| 新龙县| 长春市| 蕲春县| 蓬安县| 枣庄市| 黄梅县| 蚌埠市| 斗六市| 望谟县| 江陵县| 张家川| 奈曼旗| 苏尼特右旗| 思茅市| 通辽市| 马尔康县| 乐昌市| 长寿区| 彰化县| 探索| 梨树县| 新疆| 松阳县| 天等县| 永修县| 张家口市| 嘉义市| 图片| 北京市| 长乐市| 墨竹工卡县| 白银市| 汤阴县| 保康县| 任丘市|