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)
显示缺少libpcre.so.1, 在lib下建立pcre.so.1的软连接:
ln -s /usr/local/lib/libpcre.so.1 /lib
7.继续启动nginx
./nginx