nginx the HTTP rewrite module requires the PCRE library nginx 安装

新系统centos6.6安装nginx

根目录下,创建一个下载文件目录。

mkdir /download && cd download
wget http://nginx.org/download/nginx-1.9.13.tar.gz
tar xzf nginx-1.9.13.tar.gz && cd nginx-1.9.13
./configure --prefix=/web/server/nginx \ #这个目录自定义
--sbin-path=/web/server/nginx/sbin/nginx \
--conf-path=/web/server/nginx/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-threads \
--with-stream \
--with-stream_ssl_module \
--with-http_slice_module \
--with-http_v2_module

以上模块也根据项目的需要添加。 ./configure: error: the HTTP rewrite module requires the PCRE library. 报错了,缺少什么库就yum安装

yum -y install pcre-devel

./configure: error: SSL modules require the OpenSSL library. 还是缺少接着yum

yum -y install openssl openssl-devel

编译成功后 安装

make && make install
cd /web/server/nginx/sbin
./nginx
./nginx -t #查看配置文件是否正确
./nginx -s reload #平滑重启

浏览器输入本机ip看看结果吧!