沧海一粟

----not just a programmer

导航

linux cent os 6.5安装Nginx

1.下载相关组件

yum install -y gcc gcc-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.gz

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

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

顺次解压zlib/PCRE/OPENSSL/PURGE并安装,例如:

 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

出现上述截图证明安装成功。

注意其他主机访问该Nginx服务器需要打开服务器防火墙80端口

[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

 

安装成功直接访问如下截图

 

posted on 2017-05-06 15:12  沧海一粟-啊添  阅读(1017)  评论(0编辑  收藏  举报