首页 > 代码库 > Nginx 安装过程中遇到的一些问题及解决方法

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

一、安装

获取安装包:

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

技术分享

解压安装包:

tar -zxvf nginx-1.11.5.tar.gz

技术分享

切换到 nginx-1.11.5 目录

技术分享

执行 ./configure

出现错误:

checking for C compiler ... not found

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

技术分享

原因:没有安装gcc

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

技术分享

安装成功:

技术分享

再次执行 ./configure

出现错误:

./configure: error: the HTTP rewrite module requires the PCRE library.
技术分享

解决方法:

yum -y install pcre-devel

再次执行,出现错误

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

 解决方法:

yum -y install openssl openssl-devel

 

 然后再执行 make &&make install

技术分享

二、启动

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

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

技术分享

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

 

配置文件的修改 也需在/usr/local/nginx 目录下的conf中进行

技术分享

 

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