这次用一个国内开发者在GitHub上的开源项目https://github.com/yaoweibin/nginx_tcp_proxy_module

我的系统已经安装了最新的Nginx,现在需要下载源代码编译出自己的版本。

  1. wget http://nginx.org/download/nginx-1.5.3.tar.gz
  2. tar zxvf nginx-1.5.3.tar.gz

然后获得nginx_tcp_proxy_module的项目:

  1. git clone https://github.com/yaoweibin/nginx_tcp_proxy_module.git

现在给Nginx打补丁

  1. cd nginx-1.5.3/
  2. root@dean-GA-MA790XT-UD4P:/usr/src/nginx-1.5.3# patch -p1 < /usr/src/nginx_tcp_proxy_module/tcp.patch
  3. patching file src/core/ngx_log.c
  4. Hunk #1 succeeded at 69 (offset 3 lines).
  5. patching file src/core/ngx_log.h
  6. Hunk #1 succeeded at 30 (offset 1 line).
  7. Hunk #2 succeeded at 38 (offset 1 line).
  8. patching file src/event/ngx_event_connect.h
  9. Hunk #1 succeeded at 33 (offset 1 line).
  10. Hunk #2 succeeded at 44 (offset 1 line).

还要安装个ssl库

  1. apt-get install libssl-dev

但是卸载掉自动安装的libstdc++6-4.7-dev, 因为我用的是gcc4.8.1

  1. apt-get autoremove

好了,现在配置makefile,首先查看当前系统安装好的Nginx的配置选项:

  1. nginx -V
  2. nginx version: nginx/1.5.3
  3. built by gcc 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  4. TLS SNI support enabled
  5. configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --with-ipv6

然后原封不动的使用这些配置参数,但是加上最后一个

  1. --add-module=/usr/src/nginx_tcp_proxy_module
  1. ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --with-ipv6 --add-module=/usr/src/nginx_tcp_proxy_module

现在开始编译吧。

  1. make

得到的nginx程序位于objs目录. 将nginx服务停掉,并替换之。

  1. service nginx stop
  2. mv /usr/sbin/nginx /usr/sbin/nginx_bk
  3. /usr/src/nginx-1.5.3/objs# cp nginx /usr/sbin/
  4. service nginx start
  5. ps -def | grep nginx
  6. root 23479 1 0 23:21 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
  7. root 23480 23479 0 23:21 ? 00:00:00 nginx: worker process
  8. root 23482 13006 0 23:21 pts/0 00:00:00 grep --color=auto nginx

Nginx TCP Proxy模块的编译安装的更多相关文章

  1. Nginx 最新版源码编译安装 包含常用模块作用及所需依赖

    第一部分 Nginx最新版源码编译安装 1. 使用的模块 模块1:http_rewrite_module 基于正则匹配来实现重定向.依赖PCRE库,见依赖1 模块2:http_gzip_module ...

  2. nginx的proxy模块详解以及参数

    文章来源 运维公会:nginx的proxy模块详解以及参数 使用nginx配置代理的时候,肯定是要用到http_proxy模块.这个模块也是在安装nginx的时候默认安装.它的作用就是将请求转发到相应 ...

  3. nginx tcp proxy 连接保持设置

    根据前文Nginx tcp proxy module试用的设置,在测试环境中发现tcp连接经常掉线.在该项目站点上找到一个issue,也谈论这件事情,不过别人用在web socket协议上. 其实就是 ...

  4. swoole模块的编译安装:php编译安装swoole模块的代码

    本篇文章给大家带来的内容是关于swoole模块的编译安装:php编译安装swoole模块的代码,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 1.下载swoole 1 wget ht ...

  5. 安装成功的nginx,如何添加未编译安装模块(非覆盖安装http_image_filter_module)

    背景:1.做了图片上传小项目.2.图片上传,需要多图管理.3.图片上传,需要存储到Fastdfs.4.Fastdfs上的图片,和Nginx结合.5.Nginx从Fastdfs获得的图片,需要使用缩略图 ...

  6. nginx之 nginx-1.9.7 编译安装、理论简介

    nginx是一个web网站常用的高性能http和反向代理服务器,其具有较好的并发能力,被网易.百度.腾讯.新浪等网站广泛使用. 一. 理论简介 1.首先弄清楚正向代理和反向代理 正向代理:代理客户端, ...

  7. Nginx、MySQL、PHP 编译安装

    RHEL 7.0 编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14运行环境 准备篇: RHEL 7.0系统安装配置图解教程 http://www.jb51.net/os/192 ...

  8. nginx TCP 代理& windows傻瓜式安装

    一.下载nginx Windows http://nginx.org/en/download.html 二.解压到目录 三.进入目录并start nginx.exe即可启动 cd d:/java/ng ...

  9. 开始Nginx的SSL模块

    nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/n ...

随机推荐

  1. HDU 6085 Rikka with Candies(bitset)

    [题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=6085 [题目大意] 给出一个数组a一个数组b,以及询问数组c, 问对于每个c有多少对a%b=c,答 ...

  2. 【推导】zoj3981 Balloon Robot

    题意:一个桌子有m个位置(首尾相接),有n支队伍坐在其中的n个位置上.有个机器人会从某个起始位置出发,每个时刻会依次发生以下三个事件: 机器人顺时针转一个单位: 某些队伍通过了题目(如果存在): 如果 ...

  3. 【最大化平均值】POJ3111-K Best

    [题目大意] 给出v[]和w[],求的最大值. [思路] 二分s(S)的值,可变形为s(S)*Σw>=Σv,所以只需要把求出x*w[i]-v[i],看看前k个的和是否大于等于0,大于等于0就满足 ...

  4. AOP流程分析

    1. 注册AnnotationAwareAspectJAutoProxyCreator @EnableAspectJAutoProxy --> @Import(AspectJAutoProxyR ...

  5. Android 出现java.lang.NoClassDefFoundError错误

    项目中用到了Retrofit在android4.4以下版本发生的问题 因为项目的build.gradle文件沿用于一个项目的,在defaultConfig z中已经声明了 multiDexEnable ...

  6. CROC 2016 - Elimination Round (Rated Unofficial Edition) D. Robot Rapping Results Report 二分+拓扑排序

    D. Robot Rapping Results Report 题目连接: http://www.codeforces.com/contest/655/problem/D Description Wh ...

  7. leetcode weekly contest 43

    leetcode weekly contest 43 leetcode649. Dota2 Senate leetcode649.Dota2 Senate 思路: 模拟规则round by round ...

  8. nodejs之处理GET请求

    一个简单的httpserver.接收get请求,并返回解析之后的数据. 以下是服务的代码: var http = require("http"); var url = requir ...

  9. rabbitmq 连接測试

    1.假设写错了host (如:factory.setHost("locathost"); )报错: Exception in thread "main" jav ...

  10. jdk8 流操作

    二.流 2.1 流介绍 流是Java API的新成员,它允许你以声明性方式处理数据集合(通过查询语句来表达,而不是临时编写一个实现).就现在来说,你可以把它们看成遍历数据集的高级迭代器.此外,流还可以 ...