Nginx1.8源码包编译安装

1、下载解压Nginx,为方便管理下载包一般将下载包放在指定目录下

,即/usr/local/src/下。

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

tar zxvf nginx-1.8.0.tar.gz

2、配置编译参数

先进入解压的目录下

创建安装目录/usr/local/nginx

编译参数如下:

./configure \

--prefix=/usr/local/nginx \

--with-http_realip_module \

--with-http_sub_module \

--with-http_gzip_static_module \

--with-http_stub_status_module \

--with-http_ssl_module \

--with-pcre

出错:error: the HTTP rewrite module requires the PCRE

library.

缺少做正则的包文件:yum install -y pcre-devel

error:SSL modules require the OpenSSL library.

缺少基础依赖包:yum install -y openssl openssl-devel

openssl openssl-devel在使用HTTPS服务时要用到此模块。

3、编译nginx :make

4、安装 make install

5、查看服务是否开启:ps aux |grep nginx

查看端口是否启用:netstat -ltnp