linux下搭建nginx服务环境:rhel 6(默认最小化安装系统)软件:pcre-8.30.tar.gz ;nginx-1.3.1.tar.gz1、安装
linux下搭建nginx服务
环境:rhel 6(默认最小化安装系统)
软件:pcre-8.30.tar.gz ;nginx-1.3.1.tar.gz
1、安装缺少的依赖包
yum install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf bzip2-devel ncurses-devel openssl-devel libtool* \
zlib-devel libxml2-devel libjpeg-devel libpng-devel libtiff-devel fontconfig-devel freetype-devel libXpm-devel \
gettext-devel curl-devel curl pam-devel e2fsprogs-devel krb5-devel libidn libidn-devel -y
2、创建nginx用户www
groupadd www
useradd -g www www
3、下载安装pcre
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
放到/opt目录下
tar xvf pcre-8.30.tar.gz
cd pcre-8.30
./configure && make && make install
4、下载安装nginx
http://nginx.org/download/nginx-1.3.1.tar.gz
放到/opt目录下
tar vxf nginx-1.3.1.tar.gz
cd nginx-1.3.1
./configure \
--user=www \
--group=www \
--prefix=/usr/local/nginx/ \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-md5=/usr/lib \
--with-sha1=/usr/lib
make && make install
5、关闭防火墙,开启nginx
/etc/init.d/iptables stop
ldd /usr/local/nginx/sbin/nginx
解决方法:
ln -s /usr/local/lib/libpcre.so.1 /lib64
32位系统则:
ln -s /usr/local/lib/libpcre.so.1 /lib
注:
/usr/local/lib/libpcre.so.1 为prce安装后的文件地址
低版本prce对应的libpcre.so.1 为libpcre.so.0
6、启动nginx:/usr/local/nginx/sbin/nginx