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

相关文章
相关标签/搜索