【ubuntu】编译安装nginx及所支持库

安装c++编译工具g++ 

sudo su
apt-get install g++

安装Pcre库

mkdir /usr/local/lib/pcre8.35
cd /root/soft
wget  ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
tar -xvzf  pcre-8.35.tar.gz
cd  pcre-8.35
./configure --prefix=/usr/local/lib/pcre8.35
make
make install

安装Openssl

cd /root/soft
wget  http://www.openssl.org/source/openssl-1.0.1h.tar.gz
tar -xvzf openssl-1.0.1h.tar.gz
./config --prefix=/usr/local/openssl1.0
make
make install

安装zlib(1.2.5)

wget http://download.csdn.net/download/chinsion/3205328 
tar -xvzf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure --prefix=/usr/local/lib/zlib1.2.5
make
make install
或者
apt-get install zlib1g-dev

安装nginx(1.2.9)

wget http://nginx.org/download/nginx-1.2.9.tar.gz
cd nginx-1.2.9
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-openssl=/root/soft/openssl-1.0.1h --with-pcre=/root/soft/pcre-8.35
make
make install
注意编译的时候后面支持库指定路径为源代码路径不是安装的位置

启动或重载nginx

/usr/local/nginx/sbin/nginx -s reload

报错:nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

原因是我的80端口被占用,因为装了apache。所以只要停掉apache就可以了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章