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

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

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

然后获得nginx_tcp_proxy_module的项目:

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

现在给Nginx打补丁

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

还要安装个ssl库

apt-get install libssl-dev

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

apt-get autoremove

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

nginx -V
nginx version: nginx/1.5.3
built by gcc 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)
TLS SNI support enabled
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

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

--add-module=/usr/src/nginx_tcp_proxy_module
./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

现在开始编译吧。

make

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

service nginx stop
mv /usr/sbin/nginx /usr/sbin/nginx_bk
/usr/src/nginx-1.5.3/objs# cp nginx /usr/sbin/
service nginx start
ps -def | grep nginx
root 23479 1 0 23:21 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
root 23480 23479 0 23:21 ? 00:00:00 nginx: worker process
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. Eclipse里选中一个变量后,这个类里的该变量不变色了?

    Eclipse里选一个变量后,这个类里的该变量不变色了. 1.使用“Alt+Shift+O”对该提示功能的开/关切换 2.可以在以下设置选中后的文本提示颜色  window--> Prefere ...

  2. HDU 5575 Discover Water Tank 并查集 树形DP

    题意: 有一个水槽,边界的两块板是无穷高的,中间有n-1块隔板(有高度),现有一些条件(i,y,k),表示从左到右数的第i列中,在高度为(y+0.5)的地方是否有水(有水:k = 1),问最多能同时满 ...

  3. noip2009最优贸易

    试题描述 C 国有 n 个大城市和 m 条道路,每条道路连接这 n 个城市中的某两个城市.任意两个城市之间最多只有一条道路直接相连.这 m 条道路中有一部分为单向通行的道路,一部分为双向通行的道路,双 ...

  4. spring集合类型注入

    spring集合类型注入 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUB ...

  5. Cascode MOSFET increases boost regulator's input- and output-voltage ranges

    Targeting use in portable-system applications that require raising a battery's voltage to a higher l ...

  6. mysql字符串比较

    select '123'B is TRUE;  1 SET @a='123';            select '123'is TRUE;      0 select cast('222' as ...

  7. cocos2d3.0 Scale9Sprite

    使用Scale9Sprite须要引入以下的头文件 #include "extensions/cocos-ext.h" USING_NS_CC; USING_NS_CC_EXT; 一 ...

  8. [IIS]由安装IIS和.net framework先后顺序引发的问题,你中招了吗?

    引言 最近帮别人做了一个小网站,在本机部署测试的时候,竟然浏览不了aspx后缀的页面,但可以浏览html页面,由此想到了IIS对静态页和动态页不同的处理方式. http请求到达服务器 当服务器接收到一 ...

  9. unity 3D + Google Play In-app Billing (IAB)(转) 热度 3

    最近由于工作需要,研究unity如何接入Google Play以实现游戏内购买.目前IAB的实现,prime31做的插件比较好,各平台的IAB均有,但费用相对过高(几乎都是70刀左右,可怜穷小子).在 ...

  10. 制作Java安装程序

    这个工具利用 ANT 来制作在 Windows, MacOS X, Unix 平台上可执行的文件,比如 exe,zip,jar.ROXES ANT Tasks 基于 GPL 发布. http://ww ...