nginx源代码安装make报错

今天在安装nginx时出现如下错误:

[root@node1 nginx-0.8.55]# ./configure \ 
>  --prefix=/usr \ 
>  --sbin-path=/usr/sbin/nginx \ 
>  --conf-path=/etc/nginx/nginx.conf \ 
>  --error-log-path=/var/log/nginx/error.log \ 
>  --pid-path=/var/run/nginx/nginx.pid  \ 
>  --lock-path=/var/lock/nginx.lock \ 
>  --user=nginx \ 
>  --group=nginx \ 
>  --with-http_ssl_module \ 
>  --with-http_flv_module \ 
>  --with-http_gzip_static_module \ 
>  --http-log-path=/var/log/nginx/access.log \ 
>  --http-client-body-temp-path=/var/tmp/nginx/client/ \ 
>  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \ 
>  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/

./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= option.

上面步骤很明显缺少了一个叫pcre的库文件,安装好后并指定路径,我们接着安装。
12 [root@node1 pcre-8.02]# ./configure --prefix=/usr/local/pcre 
[root@node1 pcre-8.02]# make && make install

安装正常我们接着安装nginx.
[root@node1 nginx-0.8.55]# ./configure \
>  --prefix=/usr \
>  --sbin-path=/usr/sbin/nginx \
>  --conf-path=/etc/nginx/nginx.conf \
>  --error-log-path=/var/log/nginx/error.log \
>  --pid-path=/var/run/nginx/nginx.pid  \
>  --lock-path=/var/lock/nginx.lock \
>  --user=nginx \
>  --group=nginx \
>  --with-http_ssl_module \
>  --with-http_flv_module \
>  --with-http_gzip_static_module \
>  --http-log-path=/var/log/nginx/access.log \
>  --http-client-body-temp-path=/var/tmp/nginx/client/ \
>  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
>  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
>  --with-pcre=/usr/local/pcre

当使用make时报了如下错误:

[root@node1 nginx-0.8.55]# make 
make -f objs/Makefile 
make[1]: Entering directory `/nginx/nginx-0.8.55' 
cd /usr/local/pcre \ 
        && if [ -f Makefile ]; then make distclean; fi \ 
        && CC="gcc" CFLAGS="" \ 
        ./configure --disable-shared 
/bin/sh: line 2: ./configure: 没有那个文件或目录 
make[1]: *** [/usr/local/pcre/Makefile] 错误 127 
make[1]: Leaving directory `/nginx/nginx-0.8.55' 
make: *** [build] 错误 2

通过查阅资料原来检测环境时,不是指向安装后目录,指向pcre的源目录。如下所示即可

[root@node1 nginx-0.8.55]# ./configure \ 
>  --prefix=/usr \ 
>  --sbin-path=/usr/sbin/nginx \ 
>  --conf-path=/etc/nginx/nginx.conf \ 
>  --error-log-path=/var/log/nginx/error.log \ 
>  --pid-path=/var/run/nginx/nginx.pid  \ 
>  --lock-path=/var/lock/nginx.lock \ 
>  --user=nginx \ 
>  --group=nginx \ 
>  --with-http_ssl_module \ 
>  --with-http_flv_module \ 
>  --with-http_gzip_static_module \ 
>  --http-log-path=/var/log/nginx/access.log \ 
>  --http-client-body-temp-path=/var/tmp/nginx/client/ \ 
>  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \ 
>  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ 
>  --with-pcre=/usr/local/pcre-8.02 
[root@node1 nginx-0.8.55]# make && make install

OK!安装成功


我在安装nginx时的操作:./configure --prefix=/usr/local/opt/nginx --with-pcre=/usr/local/opt/pcre-8.31/

然后make && make install

你可能感兴趣的:(linux,Server工具/nginx)