原文链接:http://www.cnblogs.com/Detector/p/6946388.html

安装

获取安装包

使用如下的命令可以在nginx官网获取安装包,博主获取的是nginx-1.11.5这个版本

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

Nginx 安装过程中遇到的一些问题及解决方法

解压安装包

tar -zxvf nginx-1.11.5.tar.gz

Nginx 安装过程中遇到的一些问题及解决方法

切换到 nginx-1.11.5 目录

Nginx 安装过程中遇到的一些问题及解决方法

执行 nginx下的configure进行配置

./configure

错误一

checking for C compiler ... not found

./configure: error: C compiler cc is not found

Nginx 安装过程中遇到的一些问题及解决方法

原因定位:没有安装gcc

解决方法:使用root用户 执行 yum install gcc

Nginx 安装过程中遇到的一些问题及解决方法

gcc安装成功界面

Nginx 安装过程中遇到的一些问题及解决方法

再次执行 ./configure

错误二

./configure: error: the HTTP rewrite module requires the PCRE library.
Nginx 安装过程中遇到的一些问题及解决方法

原因: 缺少pcre包

解决方法yum -y install pcre-devel 进行安装

安装后再次执行./configure

错误三

错误提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library

原因:需要进行md5加密操作的没有找到md5模块

解决方法yum -y install openssl openssl-devel   安装openssl加密模块

再次执行./configure,终于成功了

然后再执行 make &&make install,执行过程没有报错,终于安装成功了

Nginx 安装过程中遇到的一些问题及解决方法

启动

nginx的启动目录在 /usr/local/nginx/sbin

直接进入该安装目录下,输入命令 ./nginx -t 即可启动

Nginx 安装过程中遇到的一些问题及解决方法

执行 ./nginx -s reload 可以进行重启操作

修改配置文件

nginx的配置在/usr/local/nginx 目录下的conf中

Nginx 安装过程中遇到的一些问题及解决方法


相关文章: