研究了一下安装步骤,实践了一把,以下是全过程
1、下载相关安装包
pcre 8.31 http://pcre.org/
nginx 1.2.4 http://nginx.org/en/download.html
2、安装pcre
tar zxvf pcre-8.31.gz
cd pcre-8.31
./configure
make
make install
3、安装nginx
tar zxvf nginx-1.2.4.tar.gz
cd nginx-1.2.4
./configure --with-http_stub_status_module --with-http_gzip_static_module --prefix=/usr/local/nginx
make
make install
/usr/local/nginx/sbin/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)
libpcre.so.1 => not found
手动加上链接
网上好多没有说明如何详细添加链接,这里着重介绍:
首先查看系统的版本:
file /sbin/init
分32位和64位,以64位为例
以下是添加链接的命令:
cd /lib
ln -s /usr/local/lib/libpcre.so.1 /lib64
然后再次启动nginx
/usr/local/nginx/sbin/nginx
确认已经启动
netstat -ntpl
访问服务器,出现以下提示,即安装成功