linux cent os 6.5安裝Nginx

1.下載相關組件nginx

yum install -y gcc gcc-c++ 安裝C/C++編譯器c++

wget http://sourceforge.net/projects/pcre/files/pcre/8.37/pcre-8.37.tar.gz服務器

wget ftp://ftp.openssl.org/source/old/1.0.1/openssl-1.0.1j.tar.gzcurl

wget http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gztcp

wget http://nginx.org/download/nginx-1.6.2.tar.gz測試

順次解壓zlib/PCRE/OPENSSL/PURGE並安裝,例如:url

 tar -zxvf openssl-1.0.1j.tar.gz 
  chmod a+x openssl-1.0.1j
 cd openssl-1.0.1j
 ./config --prefix=/usr/local --openssldir=/usr/local/openssl  
 make  
 make install  
 ./configure --prefix=/usr/local/nginx --with-pcre=/nginx/pcre-8.37/  --with-openssl=/usr/local/openssl --with-http_ssl_module
make
make install
錯誤信息:
/usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
解決方法:
cd /lib64
ln -s libpcre.so.0.0.1 libpcre.so.1
啓動方法:
啓動:nginx
中止:nginx -s stop
重載:nginx reload
 
命令測試安裝是否完成:
 curl http://127.0.0.1

出現上述截圖證實安裝成功。spa

注意其餘主機訪問該Nginx服務器須要打開服務器防火牆80端口.net

[root@localhost ]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
[root@localhost ]# /etc/init.d/iptables save
[root@localhost ]# /etc/init.d/iptables restart

 

安裝成功直接訪問以下截圖rest

相關文章
相關標籤/搜索