JUST SO SO之centOs 下 nginx安装

来源:互联网 发布:天府立交数据 编辑:程序博客网 时间:2024/05/21 23:50

linux系统为Centos 64位

第一步:从http://nginx.org/download/上下载相应的版本(或者wget http://nginx.org/download/nginx-1.11.13.tar.gz 直接在Linux上用命令下载)

第二步:解压 tar -zxvf nginx-1.11.13.tar.gz 

第三步:设置一下配置信息 .make 编译.make install 安装

./configure && make && make install

 

在配置信息的时候,也就是在第三步,出现了一下错误:

错误为:./configure: error: the HTTP rewrite module requires the PCRE library.

安装pcre-devel解决问题
yum -y install pcre-devel

还有可能出现:

错误提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library.   You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.

解决办法:

yum -y install openssl openssl-devel

第四步:启动

/usr/nginx/sbin/nginx (/usr/nginx/sbin/nginx -t 查看配置信息是否正确)

查看是否启动成功 ps -aux|grep nginx

第五步:访问nginx,出现如下图所示表示成功安装。



注:如果本机访问不到虚拟机上的nginx可能是防火墙导致,可关闭防火墙  chkconfig –level 35 iptables off

1 0