參考:http://my.oschina.net/lcdmusic/blog/289729 java
Nginx的安裝依賴nginx
模塊依賴性Nginx須要依賴下面3個包spa
1. gzip 模塊須要 zlib 庫 ( 下載: http://zlib.net/zlib-1.2.8.tar.gz ).net
2. rewrite 模塊須要 pcre 庫 ( http://www.pcre.org/ )code
( 下載: http://jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.gz?crazycache=1 )orm
3. ssl 功能須要 openssl 庫 ( 下載: http://www.openssl.org/source/openssl-fips-2.0.12.tar.gz )blog
4. Nginx ( 下載: http://nginx.org/download/nginx-1.8.1.tar.gz )ip
依賴包安裝順序依次爲:openssl、zlib、pcre, 而後安裝Nginx包.ssl
可使用 yum安裝ci
yum -y install pcre-devel yum -y install openssl openssl-devel
nginx 默認安裝在 /usr/local/nginx
rpm -q zlib rpm -q pcre rpm -q openssl rpm -q nginx
zlib-1.2.3-29.el6.x86_64 pcre-7.8-6.el6.x86_64 openssl-1.0.1e-30.el6_6.5.x86_64
依次安裝openssl-fips-2.0.2.tar.gz, zlib-1.2.7.tar.gz, pcre-8.21.tar.gz, nginx-1.2.6.tar.gz
1.安裝openssl-fips-2.0.2.tar.gz
tar -zxvf openssl-fips-2.0.2.tar.gz cd openssl-fips-2.0.2 ./config make make install
2.安裝zlib-1.2.7.tar.gz
tar -zxvf zlib-1.2.7.tar.gz cd zlib-1.2.7 ./configure make make install
3.安裝pcre-8.21.tar.gz
tar -zxvf pcre-8.21.tar.gz cd pcre-8.21 ./configure make make install
4.安裝 nginx-1.2.6.tar.gz
tar -zxvf nginx-1.2.6.tar.gz cd nginx-1.2.6 ./configure 或者 ./configure --with-pcre=../pcre-8.21 --with-zlib=../zlib-1.2.7 --with-openssl=../openssl-fips-2.0.2 make make install
至此Nginx的安裝完成!
檢測是否安裝成功
cd /usr/local/nginx/sbin ./nginx -t
啓動nginx
[root@localhost sbin]# ./nginx
查看端口
[root@localhost sbin]# netstat -ntlp
PS:卸載nginx 刪掉對應文件便可