咨询热线:4006-75-4006
售前:9:00-23:30 备案:9:00-18:00 技术:7*24h
1、pcre默认是安装的,如果没有请下载安装
(1)安装
rpm -qa pcre
rpm -e --nodes pcre
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.10.tar.gz
#tar –zxvf pcre2-10.10.tar.gz
#cd pcre2-10.10
#./configure
#make
#make intall
一般默认的安装路径是:/usr/local/share/doc/pcre2
(2)错误
根据错误提示:是没有安装gcc gcc-c++ 安装:yum install -y gcc gcc-c++
(3)如果提示错误:grep:error while loading shared libraries: libpcre.so.0:
编译pcre是需要libpcre.so.0的如果是32位下载放在/lib下,64为放在/lib64下
(4)如果嫌麻烦,就一键安装yum install pcre 自动安装在/usr/share/doc目录下。可以用rpm -ql pcre命令查看
2.下载安装zlib
wget http://www.landui.com/zlib-1.2.8.tar.gz
tar –zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure –prefix=/usr/local/share/zlib
make
make install
3.下载nginx
#wget http://www.landui.com/download/nginx-1.8.0.tar.gz
#tar –zxvf nginx-1.8.0.tar.gz
#cd nginx-1.8.0
#./configure –prefix=/usr/local/share/nginx –with-pcre=/usr/local/share/doc/pcre2 –with-zlib=/usr/local/share/zlib
4.当然如果觉得麻烦也可以用yum安装
方法一:
首先要安装下nginx源:
rpm -ivh http://www.landui.com/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum install nginx
方法二:
touch /etc/yum.repos.d/nginx.repo
vi /etc/yum.repos.d/nginx.repo
输入:
[nginx]
name=nginx repo
baseurl=http://www.landui.com/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
保存退出
yum makecache
yum install nginx
5.查看是否安装成功
6.如果您是用命令安装的,可以用rpm -ql nginx命令查看安装路径:
为了保持nginx.conf的整洁我们可以引入.conf文件,如需要在nginx.conf文件末尾最后一个括号内添加:
include /etc/nginx/conf.d/*conf;语句
7.例如建立一个www.landui.com的站点
#cd /etc/nginx/conf.d/
#cp default.conf test.conf
#vi test.conf
#修改站点更目录、索引、监听端口、域名等。