CentOS7.0 安裝nginx-1.9.10

下載模塊依賴性Nginx須要依賴下面3個包
1.gzip 模塊須要 zlib 庫 ( 下載: http://www.zlib.net/ )
2.rewrite 模塊須要 pcre 庫 ( 下載: http://www.pcre.org/ )
3.ssl 功能須要 openssl 庫 ( 下載: http://www.openssl.org/ )nginx

openssl centos

#  tar zxvf openssl-fips-2.0.9.tar.gz瀏覽器

#  cd openssl-fips-2.0.9服務器

#  ./config && make && make installsvn

pcre:centos7

# tar zxvf pcre-8.36.tar.gzspa

# cd pcre-8.36.net

# ./configure && make && make installorm

zlib:ip

# tar zxvf zlib-1.2.8.tar.gz

# cd zlib-1.2.8

# ./configure && make && make install

nginx:

#  tar zxvf nginx-1.9.10.tar.gz

#  cd nginx-1.8.0

#  ./configure 

注:這一步可能會報錯

錯誤方式:./configure --with-pcre=/opt/usr/local/rely/nginx/pcre-8.38 --with-zlib=/opt/usr/local/rely/svn/zlib-1.2.5 --with-openssl=/opt/usr/local/rely/svn/openssl-1.0.0 --with-http_ssl_module

本人在這裏繞了很大的彎子,提示報的錯誤是找不到zlib包,可是我把他全部依賴的包的路徑全都加上了給他,還一直找不到緣由,浪費了不少時間。因此 ./configure 提示查什麼就加什麼 不要像我同樣多此一舉。

本人最後成功方式:./configure --with-zlib=/opt/usr/local/rely/svn/zlib-1.2.5 

注1:/opt/usr/local/rely/svn/zlib-1.2.5  這個路勁不是安裝後的路徑,而是解壓後的路徑

注2:若是沒成功,注意看 ./configure  執行完後報的錯誤信息,通常錯誤信息和其依賴的包有關。

# make && make install

注:若是沒報錯,那麼就安裝成功。

防火牆配置(由於是用centos7.0 因此這裏配置和之前的 iptables 不同)
# sudo firewall-cmd --permanent --zone=public --add-service=http 
# sudo firewall-cmd --permanent --zone=public --add-service=https
# sudo firewall-cmd --reload


此時您在瀏覽器輸入您的地址(如:localhost 或者您的 服務器地址 xxx.xx.xx.xxx),若是有nginx相關返回頁面顯示即安裝完成。

相關文章
相關標籤/搜索