linux之nginx安装
2017-03-28 本文已影响14人
吴世浩
一、好言
这个世界有太多无法理解,我们能做的就是 爱我所爱 恨我所恨 人生那么短 好酒要喝完
二、背景
这是配置disconf的记载,今天算是配置成功了,所以记载下nginx的配置如下。
三、内容
下载nginx后,解压
wget http://nginx.org/download/nginx-1.8.1.tar.gz
tar nginx-1.8.1.tar.gz
cd nginx-1.8.1
./configure --prefix=/usr/local/nginx
上面后面编译部分可能出错如下
错误一:
./configure: 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=<path> option.
Paste_Image.png
解决处理,安装pcre-devel
yum -y install pcre-devel
错误二:
./configure: 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=<path> option.
Paste_Image.png
解决处理:
yum install -y zlib-devel
Paste_Image.png
make
Paste_Image.png
make install
Paste_Image.png
查看nginx状态
/usr/local/nginx/sbin/nginx -t
启动
/usr/local/nginx/sbin/nginx
重启
/usr/local/nginx/sbin/nginx -s reload