Centos610Nginx-TCP proxy setup configuration

 

1. Install Nginx

  See " nginx " Installation

2. Download nginx_tcp_proxy_moduleModule

  Download wget https://github.com/yaoweibin/nginx_tcp_proxy_module/archive/master.zip

  Unzip unzip master.zip

  

       Nginx into the source directory cd ncd /opt/download/nginx-1.9.9

  Empty last compilation make clean

  Modify the file vi ../nginx_tcp_proxy_module-master/ngx_tcp_upstream.h  

    144行:ngx_resolver_addr_t --> ngx_addr_t

  Patch  patch -p1 < /opt/download/nginx_tcp_proxy_module-master/tcp.patch 根据提示输入y 回车

  Results of the  

patching file src/core/ngx_log.c
Hunk #1 FAILED at 66.
1 out of 1 hunk FAILED -- saving rejects to file src/core/ngx_log.c.rej
patching file src/core/ngx_log.h
Hunk #1 FAILED at 29.
Hunk #2 FAILED at 37.
2 out of 2 hunks FAILED -- saving rejects to file src/core/ngx_log.h.rej
patching file src/event/ngx_event_connect.h
Hunk #1 succeeded at 33 (offset 1 line).
Hunk #2 succeeded at 44 with fuzz 2 (offset 1 line).

 

  生成编译 ./configure --with-http_stub_status_module  --add-module=../nginx_tcp_proxy_module-master

  result:

    

    Compile make

    Upgrading make upgrade      

3. Copy the compiled file

  Into the directory cd /opt/download/nginx-1.9.9/objs

  Copy files cp nginx / usr / local / nginx / sbin /

4. Add the result verification module

  service nginx restart

  

   Startup is complete, add a description nginx_tcp_proxy_module completed.

5. Add configuration tcp

 cd /usr/local/nginx/conf

 mkdir tcpconfigs

 vi nginx.conf added in front http {} as follows 

tcp{
    timeout 1d;
    proxy_read_timeout 10d;
    proxy_send_timeout 10d;
    proxy_connect_timeout 30;
    include tcpconfigs/*.conf;    
}

  cd /tcpconfigs

  Insert the following code configured vi dfs_tracker.conf

upstream fdfs_tracker {
         server 192.168.125.155:22122;
         check interval=3000 rise=2 fall=5 timeout=1000;
    }
server {
        listen  9011;
        proxy_pass fdfs_tracker;
        #so_keepalive on;
        #tcp_nodelay on;
}

   Save and exit

   Restart nginx

 service nginx restart

 

  Startup is complete.

 

 

 

  

 

 

  

 

Guess you like

Origin www.cnblogs.com/oumi/p/12105171.html