Nginx compilation supports Tcp_wrappers

Source: Internet
Author: User
Tags wrappers reverse dns

Nginx compilation supports Tcp_wrappers

Tcp wrappers: Transmission Control Protocol (TCP) Wrappers provides enhanced security for services generated by inetd. Tcp wrappers is a replacement method for using/etc/inetd. sec. TCP Wrappers provides protection against host name and host address spoofing. Spoofing is a method disguised as a valid user or host to obtain unauthorized access to the system.

1. recompile Nginx

  1. [Root @ ipython nginx-1.6.1] # tar zxf ../ngx_tcpwrappers.tar.gz-C ./
  2. [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-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 -- -pcre =/root/pcre-8.35 -- with-openssl =/root/openssl-1.0.1i -- with-zlib =/root/zlib-1.2.8 -- add-module =. /ngx_tcpwrappers
  3. [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
  4. #### Do not make install. compile it ####
  5. [Root @ ipython nginx-1.6.1] # make

 

2. Complete the upgrade and use of modules. Nginx is still very strange ~~

  1. #### Back up executable files and copy new files ####
  2. [Root @ ipython nginx-1.6.1] # mv/software/nginx/sbin/nginx/software/nginx/conf/@ nginx
  3. [Root @ ipython nginx-1.6.1] # cp objs/nginx/software/nginx/sbin/
  4. #### Test the new version of Nginx ####
  5. [Root @ ipython nginx-1.6.1] #/software/nginx/sbin/nginx-t
  6. Nginx: the configuration file/software/nginx/conf/nginx. conf syntax is OK
  7. Nginx: configuration file/software/nginx/conf/nginx. conf test is successful
  8. ### Access without the Tcp_wrappers configuration test ###
  9. [Root @ ipython openssl-1.0.1i] # curl-I http://www.ipython.me
  10. HTTP/1.1200 OK
  11. Server: nginx/1.6.1
  12. Date: Mon, 11Aug201423: 08: 08 GMT
  13. Content-Type: text/html
  14. Content-Length: 612
  15. Last-Modified: Mon, 11Aug201422: 45: 25 GMT
  16. Connection: keep-alive
  17. ETag: "53e94785-264"
  18. Accept-Ranges: bytes
  19. ### Smooth upgrade ###
  20. [Root @ ipython nginx-1.6.1] # make upgrade
  21. # Test Module: reject the Nginx request 1.1.1.30 ### Add the following configuration in the http block ##
  22. Tcpwrappers on;
  23. Tcpwrappers_daemon nginx;
  24. Tcpwrappers_thorough off;
  25. # Hosts. deny as follows ##
  26. [Root @ ipython nginx-1.6.1] # awk '! /^ #/'/Etc/hosts. deny
  27. Nginx: 1.1.1.30
  28. # Re-read the Nginx configuration file ##
  29. [Root @ ipython nginx-1.6.1] #/software/nginx/sbin/nginx-s reload
  30. ### In this case, access is 403 ###
  31. [Root @ itchenyi ~] # Curl-I http://www.ipython.me
  32. HTTPS/1.1403 Forbidden
  33. Server: nginx/1.6.1
  34. Date: Mon, 11Aug201423: 12: 47 GMT
  35. Content-Type: text/html
  36. Content-Length: 168
  37. Connection: keep-alive

 

3. Tcp_warppers module command

  1. ### Ngx_Tcp_wrappers configuration command ###
  2. 1. tcpwrappers
  3. Syntax: tcpwrappers [on | off]
  4. Default Value: tcpwrappers off
  5. Scope: http, server, location, limit_0000t
  6. Description: module switch. When enabled, use TCP Wrappers for access control.
  7. 2. tcpwrappers_daemon
  8. Syntax: tcpwrappers_daemon name
  9. Default Value: tcpwrappers_daemon nginx
  10. Scope: http, server, location, limit_0000t
  11. Description: The definition of the name is used for identification in/etc/hosts. [allow | deny ].
  12. 3. tcpwrappers_thorough
  13. Syntax: tcpwrappers_thorough [on | off]
  14. Default Value: tcpwrappers_thorough off
  15. Scope: http, server, location, limit_0000t
  16. Description: Checks IP addresses, user names, and reverse DNS resolution based on hosts. ctl. The module developer does not provide detailed instructions for use.

-------------------------------------- Split line --------------------------------------

Deployment of Nginx + MySQL + PHP in CentOS 6.2

Build a WEB server using Nginx

Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5

Performance Tuning for Nginx in CentOS 6.3

Configure Nginx to load the ngx_pagespeed module in CentOS 6.3

Install and configure Nginx + Pcre + php-fpm in CentOS 6.4

Nginx installation and configuration instructions

Nginx log filtering using ngx_log_if does not record specific logs

-------------------------------------- Split line --------------------------------------

Nginx details: click here
Nginx: click here

From: http://www.ipython.me/centos/rebuild-nginx-support-tcp_wrappers.html Author: IT Chen Yi

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.