nginx的安装与配置,中途遇到问题的解决

我使用的是ubuntu13.04系统,在安装nginx的时候遇到如下几个问题,然后找思路解决的,nginx 的下载与安装

 

wget http://nginx.org/download/nginx-1.0.11.tar.gz
tar zxvf nginx-1.0.11.tar.gz
./configure
make
make install

 

安装的时候出现错误如下:

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

 

解决方法,安装pcre包,代码如下:

 

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
tar zxvf pcre-8.37.tar.gz
./configure
make
make install

 

然后再去安装 nginx,重复第一步,结果如下,说明安装好了:

Configuration summary

  + using system PCRE library

  + OpenSSL library is not used

  + md5: using system crypto library

  + sha1: using system crypto library

  + using system zlib library

 

  nginx path prefix: "/usr/local/nginx"

  nginx binary file: "/usr/local/nginx/sbin/nginx"

  nginx configuration prefix: "/usr/local/nginx/conf"

  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"

  nginx pid file: "/usr/local/nginx/logs/nginx.pid"

  nginx error log file: "/usr/local/nginx/logs/error.log"

  nginx http access log file: "/usr/local/nginx/logs/access.log"

  nginx http client request body temporary files: "client_body_temp"

  nginx http proxy temporary files: "proxy_temp"

  nginx http fastcgi temporary files: "fastcgi_temp"

  nginx http uwsgi temporary files: "uwsgi_temp"

  nginx http scgi temporary files: "scgi_temp"

 

接着启动nginx报错如下:

./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

通过这个命令查看:ldd $(which /usr/local/nginx/sbin/nginx)

结果如下显示:

linux-vdso.so.1 =>  (0x00007fffa89fe000)

libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc08b3c3000)

libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fc08b18a000)

libpcre.so.1 => not found

libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fc08adae000)

libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fc08ab97000)

libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc08a7cd000)

/lib64/ld-linux-x86-64.so.2 (0x00007fc08b5fa000)

libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc08a5c9000)

 解决方法:添加软链接,          ln -s /usr/local/lib/libpcre.so.1  /lib/x86_64-linux-gnu/libpcre.so.1

最后启动nginx,没有报错,启动成功。

 

猜你喜欢

转载自qifeifei.iteye.com/blog/2210076