1、安装编译工具及库文件
yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
2、安装PCRE
wget https://jaist.dl.sourceforge.net/project/pcre/pcre/8.44/pcre-8.44.tar.gz
解压tar zxvf pcre-8.44.tar.gz
进入pcre-8.44编译安装
cd pcre-8.44
./configure
make && make install
3、安装Nginx
wget http://nginx.org/download/nginx-1.6.2.tar.gz
解压tar zxvf nginx-1.6.2.tar.gz
进入nginx-1.6.2编译安装
cd nginx-1.6.2
./configure --prefix=/opt/nginx(指定Nginx安装路径) --with-http_stub_status_module --with-http_ssl_module --with-pcre=/opt/pcre-8.44(pcre解压路径)
make
make install
cd /opt/nginx/sbin
启动./nginx
停止./nginx -s stop
重启./nginx -s reload
校验配置文件./nginx -t
查看版本./nginx -v
非root用户启动nginx,先以root登录执行setcap cap_net_bind_service=+eip /opt/nginx/sbin/nginx