系統(tǒng):Centos6.6 64位
Nginx: http://nginx.org/en/download.html 今朝最新版本1.9.4 我下載1.8.0
下載模塊依賴(lài)性Nginx需要依賴(lài)下面3個(gè)包
1.gzip 模塊需要 zlib 庫(kù) ( 下載: http://www.zlib.net/ )
2.rewrite 模塊需要 pcre 庫(kù) ( 下載: http://www.pcre.org/ )
3.ssl 成果需要 openssl 庫(kù) ( 下載: http://www.openssl.org/ )
依賴(lài)包安裝順序依次為:openssl、zlib、pcre, 然后安裝Nginx包
假如沒(méi)有安裝c++編譯情況,還得安裝,通過(guò)yum install gcc-c++完成安裝
下載完成后:
下一步,編譯安裝
openssl :
[[email protected]] tar zxvf openssl-fips-2.0.9.tar.gz
[[email protected]] cd openssl-fips-2.0.9
[[email protected]] ./config && make && make install
pcre:
[[email protected]] tar zxvf pcre-8.36.tar.gz
[[email protected]] cd pcre-8.36
[[email protected]] ./configure && make && make install
zlib:
[[email protected]]tar zxvf zlib-1.2.8.tar.gz
[[email protected]] cd zlib-1.2.8
[[email protected]] ./configure && make && make install
最后安裝nginx
[[email protected]]tar zxvf nginx-1.8.0.tar.gz
[[email protected]] cd nginx-1.8.0
[[email protected]] ./configure && make && make install
安裝完成后,深圳論壇空間 香港主機(jī),可啟動(dòng)nginx:
啟動(dòng)呼吁:/usr/local/nginx/sbin/nginx
發(fā)明報(bào)錯(cuò)了:
error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
經(jīng)網(wǎng)上查詢(xún),這是linux的通病
[[email protected] nginx]# sbin/nginx
sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
[[email protected] nginx]# error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
[[email protected] nginx]# whereis libpcre.so.1
libpcre.so: /lib64/libpcre.so.0 /usr/local/lib/libpcre.so /usr/local/lib/libpcre.so.1
[[email protected] nginx]# ln -s /usr/local/lib/libpcre.so.1 /lib64
[[email protected] nginx]# sbin/nginx
先找到libpcre.so.1地址位置,然后做個(gè)軟鏈接就可以了。
查察是否已啟動(dòng):
通過(guò)欣賞器會(huì)見(jiàn):
看到這個(gè)就說(shuō)明nginx安裝并啟動(dòng)樂(lè)成。
ps:
啟動(dòng):/usr/local/nginx/sbin/nginx
遏制/從頭加載:/usr/local/nginx/sbin/nginx -s stop(quit、reload)
驗(yàn)證設(shè)置文件是否正當(dāng):/usr/local/nginx/sbin/nginx -t
呼吁輔佐:/usr/local/nginx/sbin/nginx -h