安装nginx-11037915
查看环境Nginx的安装
模块依赖性Nginx需要依赖下面3个包
1. gzip 模块需要 zlib 库 ( 下载: http://www.zlib.net/ )
2. rewrite 模块需要 pcre 库 ( 下载: http://www.pcre.org/ )
3. ssl 功能需要 openssl 库 ( 下载: http://www.openssl.org/ )
判断是否安装gccgcc-c++
存在
# rpm-qgcc 或者 rpm –qlgcc 列出所有的文件路径
gcc-4.4.7-18.el6.x86_64
查看是否已经安装了REPC
rpm -qa | grep“REPC”
好的这里看到已经安装了。同理查看opensslgzipwget
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
安装make:
yum -y installgccautomake autoconf libtool make
安装g++ c++
yum install gcc gcc-c++ 第一种方法源码安装
依赖包安装顺序依次为:openssl、zlib、pcre, 然后安装Nginx包.
第二步:依次安装openssl-fips-2.0.2.tar.gz,zlib-1.2.7.tar.gz, pcre-8.21.tar.gz, nginx-1.2.6.tar.gz
1.安装openssl-fips-2.0.2.tar.gz
# tar -zxvf openssl-fips-2.0.2.tar.gz
# cd openssl-fips-2.0.2
# ./config
# make
# makeinstall
2.安装zlib-1.2.7.tar.gz
# tar -zxvf zlib-1.2.7.tar.gz
# cd zlib-1.2.7
# ./configure
# make
# make install
3.安装pcre-8.21.tar.gz
# tar -zxvf pcre-8.21.tar.gz
# cd pcre-8.21
# ./configure
# make
# make install
第二种方法 通过yum
yum-y installzlibzlib-devel opensslopenssl—develpcrepcre-devel
或者是
yum install pcre*
yum install openssl*
yum install zlib
yum install zlib-devel
yum install wget
遇到错误
错误为:./configure: error: the HTTP rewrite module requires the PCRElibrary.
第一种方法处理
安装pcre-devel解决问题
yum -y install pcre-devel
yum -y install openssl openssl-devel
第二种方法处理 源码包
3.安装pcre-8.21.tar.gz
# tar -zxvf pcre-8.21.tar.gz
# cd pcre-8.21
# ./configure
# make
# make install
4.安装 nginx-1.2.6.tar.gz
# tar -zxvf nginx-1.2.6.tar.gz
# cd nginx-1.2.6
# ./configure--with-pcre=../pcre-8.21 --with-zlib=../zlib-1.2.7 --with-openssl=../openssl-fips-2.0.2
或者:# ./configure
# make
# make install
遇到错误
错误为:./configure: error: the HTTP rewrite module requires the PCRElibrary.
如上处理
修改端口
vi/ usr / local / nginx/conf/nginx.conf
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
Esc :wq
在防火墙设置端口
# vi /etc / sysconfig / iptables
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
重启端口服务
Service iptables restart
查看端口服务
/etc/init.d/iptables status
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
启动nginx
/usr/local/nginx/nginx 或者 /usr/local/nginx/sbin/nginx
重启nginx
/usr/local/nginx/sbin/nginx-s> /usr/local/nginx/sbin/nginx-s reopen
查看进程号
ps -ef|grep "nginx"
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
杀死进程
# kill -QUIT 16717
强制停止
# pkill -9 nginx
项目文件存放路径
放到这个文件下,创建文件夹放入就好。
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
安装位置就是--prefix指定的/usr/local/nginx,配置文件位置:/usr/local/nginx/nginx.conf或者 /usr/local/nginx/conf/nginx.conf
页:
[1]