(一)首先要安装pcre ,他作用是让ngnix支持rewrite功能
yum -y install make zlib zlib-devel gcc-c++ libtool
mkdir -p /home/oldboy/tools
cd /home/oldboy/tools
wget http://sourceforge.jp/frs/g_redir.php?m=jaist&f=%2Fpcre%2Fpcre%2F8.30%2Fpcre-8.30.tar.gz
tar zxf pcre-8.30.tar.gz
cd pcre-8.30/
./configure
make&&make install
cd ../
(二)安装nginx
cd /home/oldboy/tools
wget http://nginx.org/download/nginx-1.2.3.tar.gz
useradd nginx -s /sbin/nologin -M
tar zxf nginx-1.2.3.tar.gz
cd nginx-1.2.3
./configure --user=nginx --group=nginx --prefix=/application/nginx-1.2.3 --with-http_stub_status_module --with-http_ssl_module (如果有报错就yum -y install openssl*)
make && make install
3.启动nginx
cd /usr/local/nginx/sbin
./nginx
如果报错:./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
则做软链接:
ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
有些是lib目录做上诉操作
如果make时候缺失aclocal:
###安装autoconf
wget http://mirrors.kernel.org/gnu/autoconf/autoconf-2.65.tar.gz
&& tar -xzvf autoconf-2.65.tar.gz
&& cd autoconf-2.65
&& ./configure --prefix=/usr/local
make && make install
cd ..
###安装automake
wget http://mirrors.kernel.org/gnu/automake/automake-1.11.tar.gz
&& tar xzvf automake-1.11.tar.gz
&& cd automake-1.11
&& ./configure --prefix=/usr/local
make && make install
cd ..
如果仍然按照pcre失败,可以重新make clean或者重新解压再安装pcre