CentOS源码编译安装Nginx和tcp_proxy module

http://nginx.org/en/download.html下载最新版本的Nginx并安装.

一 下载并安装pcre库ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

   tar zxvf pcre-8.30.tar.gz
   ./configure     make    make install
二 安装openssl 
   yum -y install openssl openssl-devel
三 下载tcp_proxy_module
四 安装nginx
export NGINX_VERSION=1.2.1
tar -xvzf nginx-$NGINX_VERSION.tar.gz
cd nginx-$NGINX_VERSION
patch -p1 < ../nginx_tcp_proxy_module/tcp.patch
./configure --add-module=../nginx_tcp_proxy_module/
sudo make && make install
 

启动nginx上时,服务无法启动,出现libpcre.so.1 not found的错误,解决方法如下:

先执行下述命令,查看

---#ldd $(which /usr/sbin/nginx)

显示如下:

    linux-vdso.so.1 =>  (0x00007fff7e9db000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe4629d0000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fe462799000)
    libpcre.so.1 => not found//果然没找到
    libz.so.1 => /lib64/libz.so.1 (0x00007fe462582000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fe4621e1000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fe462bfa000)
    libfreebl3.so => /lib64/libfreebl3.so (0x00007fe461f7e000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fe461d7a000)

执行如下:

 ----#cd /lib64

 ----#ln -s libpcre.so.0.0.1 libpcre.so.1

再次查看一下:

 ----#ldd $(which /usr/sbin/nginx)

显示已经ok了:

    linux-vdso.so.1 =>  (0x00007fff4d7ff000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb06f13e000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fb06ef07000)
    libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fb06ecda000)
    libz.so.1 => /lib64/libz.so.1 (0x00007fb06eac4000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fb06e723000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fb06f368000)
    libfreebl3.so => /lib64/libfreebl3.so (0x00007fb06e4c0000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fb06e2bc000)

 

为websocket应用实现负载均衡 http://cnodejs.org/topic/4f16442ccae1f4aa270010b3 

Reverse Proxy Web Sockets with Nginx and Socket.IO http://www.letseehere.com/reverse-proxy-web-sockets

 

你可能感兴趣的:(centos)