码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS6.5下Nginx1.7.4安装记录

时间:2014-09-12 19:10:24      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:linux   centos   nginx   安装   pcre   

1.环境准备

yum -y install gcc gcc-c++ autoconf automake make

yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel 

不执行以上两项安装的话,就可能会遇到下面我的安装过程中遇到的情况:


到此页面下载自己想要的版本:

http://nginx.org/en/download.html

左侧为Linux版本,右侧为Windows版本

bubuko.com,布布扣

使用以下命令下载文件:wget http://nginx.org/download/nginx-1.7.4.tar.gz

bubuko.com,布布扣

解压文件:tar -zxvf nginx-1.7.4.tar.gz 

bubuko.com,布布扣

切换目录:cd nginx-1.7.4

配置:./configure

bubuko.com,布布扣

提示以下信息:./configure: error: the HTTP rewrite module requires the PCRE library.

You can either disable the module by using --without-http_rewrite_module

option, or install the PCRE library into the system, or build the PCRE library

statically from the source with nginx by using --with-pcre=<path> option.

bubuko.com,布布扣

要安装pcre ,他作用是让ngnix支持rewrite功能

使用命令安装:yum install pcre-devel.i686

bubuko.com,布布扣

输入y,回车

bubuko.com,布布扣

最后提示Complete,说明安装成功:

bubuko.com,布布扣

再执行./configure

还是提示同样的错误;

执行命令查找PCRE的安装位置:file -name pcre

得到的是:./auto/lib/pcre

bubuko.com,布布扣

根据提示在后面添加参数指定Path

执行命令:./configure --with-pcre=./auto/lib/pcre

提示如下信息:

./configure: error: the HTTP gzip module requires the zlib library.

You can either disable the module by using --without-http_gzip_module

option, or install the zlib library into the system, or build the zlib library

statically from the source with nginx by using --with-zlib=<path> option.

 

还缺少zlib library信息!

执行以下命令安装:yum -y install make zlib zlib-devel gcc-c++ libtool

安装成功之后,再执行命令:./configure --with-pcre=./auto/lib/pcre

最后的提示信息如下:

bubuko.com,布布扣

应该是配置成功了,执行以下命令安装:

make && make install

提示以下错误:

bubuko.com,布布扣

该装的都装了,还是无法安装,最后执行以下命令解决问题:

yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel

执行之后再执行:./configure

再执行:make && make install

安装完成!

bubuko.com,布布扣

记住上图中的一些目录位置!

修改配置文件:

切换目录:cd /usr/local/nginx/conf

修改文件:vi nginx.conf

主要是修改server配置节的内容,按字母i进入编辑模式

bubuko.com,布布扣

ESC键,退出编辑模式,按冒号键“:”进入命令模式,输入“wq”然后回车,保存并退出;

 

切换到sbin目录:cd /usr/local/nginx/sbin

启动Nginx:./nginx

开放防火墙端口:

/sbin/iptables -I INPUT -p tcp --dport 88 -j ACCEPT

/etc/init.d/iptables save

 

打开浏览器,输入以下地址访问吧:

http://你的服务器IP:88/

看到以下信息了吗?

bubuko.com,布布扣

我是看到了,看不到的朋友继续努力吧!




CentOS6.5下Nginx1.7.4安装记录

标签:linux   centos   nginx   安装   pcre   

原文地址:http://blog.csdn.net/testcs_dn/article/details/39233569

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!