nginx源码安装教程(CentOS)

1.说明

官方源码安装说明:http://nginx.org/en/docs/configure.html

源码包下载地址:http://nginx.org/en/download.html

版本说明:Mainline--开发版;Stable--稳定版;Legacy--历史版本

 

2.安装(以1.10.3为例)

tar -zxvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./configure
make
make install
ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx

如果是想要升级原有nginx,先使用nginx -V查看原有nginx的编译参数再以相同参数进行configure

默认主配置文件目录(可通过nginx -t命令查看):/usr/local/nginx/conf/nginx.conf

 

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

解决办法:yum install -y pcre pcre-devel

./configure报错:./configure: error: the HTTP gzip module requires the zlib library.

解决办法: yum install -y zlib zlib-devel

 

3.启动和停止nginx

启动:

nginx    #可以使用-t检查当前配置文件是否有误,可用-c指定配置文件

停止:

nginx -s stop  #如果只是想重新加载一下当前配置文件可使用nginx -s reload

 

参考:

http://www.cnblogs.com/fhen/p/5896105.html

 

posted on 2017-03-13 16:18  诸子流  阅读(649)  评论(0编辑  收藏  举报