Linux下nginx的安装

遇到的问题

the HTTP rewrite module requires the PCRE library

error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using –without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using –with-pcre= option.

解决方案:

yum -y install pcre-devel

the HTTP gzip module requires the zlib library

error: the HTTP gzip module requires the zlib library.
You can either disable the module by using –without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using –with-zlib= option.

解决方案:

yum install -y zlib-devel

C compiler cc is not found

原因:

缺少 gcc-c++ 的包

解决方案:

yum -y install gcc-c++

nginx的下载及安装

官网

1
2
3
4
5
6
7
8
9
10
// 下载
wget http://nginx.org/download/nginx-1.14.0.tar.gz
// 解压
tar xzvf nginx-1.14.0.tar.gz
// 进入 nginx-1.14.0目录
cd nginx-1.14.0
// 安装
./configure
make
make install

启动nginx

进入安装目录,默认为/usr/local/nginx

./sbin/nginx

停止nginx

nginx -s stop

重启nginx

nginx -s reload