1,下载module模块
下载地址 : https://nodeload.github.com/yaoweibin/nginx_tcp_proxy_module/zipball/master
$ wget 'http://nginx.org/download/nginx-1.2.1.tar.gz'
$ tar -xzvf nginx-1.2.1.tar.gz
$ cd nginx-1.2.1/
$ patch -p1 < /path/to/nginx_tcp_proxy_module/tcp.patch /path是指nginx_tcp_proxy_module路径
$ ./configure --add-module=/usr/local/ngx_cache_purge-1.4 --prefix=/usr/local/nginx --with-http_stub_status_module --add-module=/path/to/nginx_tcp_proxy_module //编译
$ make
$ make install
http {
server {
listen 80;
location /status {
check_status;
}
}
}
tcp {
upstream mysql{
server 10.10.10.17:3306 weight=1;
server 10.10.10.18:3306 weight=1;
#check interval=3000 rise=2 fall=5 timeout=1000;
}
server {
listen 3306;
proxy_pass mysql;
}
}
./configure --add-module=../ngx_cache_purge-2.0 --with-http_stub_status_module --with-http_ssl_module --add-module=../nginx_tcp_proxy_module-master
http://blog.csdn.net/gzh0222/article/details/7956270