【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就可以了。

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