天天看點

linux中nginx的安裝,linux的版本是ubutu

linux環境下,安裝nginx,報錯如下:

the HTTP rewrite module requires the PCRE library.      

 1.需要安裝pcre,報一下錯誤:

you need a c++ compiler      

    解決方法:安裝c++編譯器:

sudo apt-get install build-essential      

2.configure,make之後報一下錯誤

/home/user/Downloads/pcre-8.36/missing: line 81: aclocal-1.14: command not found
WARNING: 'aclocal-1.14' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
make: *** [aclocal.m4] Error 127      

3.安裝auto-make

  1):在軟體中心安裝以下autotools-dev、automake、 autoconf2.13、m4、perl、libperl5.14、libtool

  2):在pcre解壓包下執行以下指令 sudo autoreconf -ivf

       關于autoreconf:autoconf能夠用來執行項目所需的autoconf、automake和libtool包中的配置工具。設計autoreconf的目的是為了減少重新生成配置腳本所需要的時間。這是通過基于時間戳,如果你隻有一個configure.ac檔案,這将會生成配置腳本,運作腳本以及運作make。

4.安裝pcre:make,make install

5.安裝nginx,提示缺少zlib,安裝zlib:

sudo apt-get install zlib1g-dev
      

 6.繼續安裝nginx,成功,開始啟動nginx,報出錯誤如下:

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

   查找關聯關系:

[root @localhost conf]# ldd $(which /usr/local/nginx/sbin/nginx)
linux-gate.so.1 =>  (0x0071b000)
libpthread.so.0 => /lib/libpthread.so.0 (0×00498000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0×00986000)
libpcre.so.1 => not found
libcrypto.so.6 => /lib/libcrypto.so.6 (0×00196000)
libz.so.1 => /lib/libz.so.1 (0×00610000)
libc.so.6 => /lib/libc.so.6 (0x002d7000)
/lib/ld-linux.so.2 (0x006a8000)      
ln -s /usr/local/lib/libpcre.so.1 /lib