编译安装nginx-1.6.3

一、安装pcre

   yum -y install pcre pcre-devel

wKiom1hjFAiC5G2RAAAC-Ja61PI046.png-wh_50

二、安装openssl

  yum -y install openssl openssl-devel

wKiom1hjFErzWe42AAAC92hRrqs950.png-wh_50

编译安装nginx-1.6.3_第1张图片

三、编译安装nginx

1、创建目录/usr/tools/

mkdir -p /usr/tools

wKiom1hjFKmSAH_RAAAITuHbrMw011.png-wh_50

2、nginx官网上下载nginx-1.6.3压缩包

  cd /usr/tools

  wget -q http//nginx.org/download/nginx-1.6.3.tar.gz

编译安装nginx-1.6.3_第2张图片

3、解压nginx-1.6.3压缩包

  tar xf nginx-1.6.3

wKioL1hjFOOBSfEKAAAJjr9XkQo258.png-wh_50

4、创建nginx虚拟用户

   useradd nginx -s /etc/nologin -M

wKiom1hjFPHihAPsAAAD5qevfPo271.png-wh_50

5、编译安装nginx

./configure --user=nginx --group=nginx --prefix=/application/nginx-1.6.3 --with-http_stub_status_module --with-http_ssl_module


wKioL1hjFRTAFDklAAAGqpOIjKI289.png-wh_50

编译安装nginx-1.6.3_第3张图片

make

make install

四、启动nginx服务

1、ln -s /application/nginx-1.6.3/ /application/nginx

     /application/nginx/sbin/nginx -t 检查语法

     /application/nginx/sbin/nginx   回车启动nginx

wKioL1hjFSjRIUZIAAAVix0VI6A361.png-wh_50 

  lsof -i :80检查80端口是否开启

wKiom1hjFTfSJ3vIAAANtTjY6h4981.png-wh_50

2、在浏览器中输入192.168.126.133打不开,但能够ping

编译安装nginx-1.6.3_第4张图片 

  setenforce 0   关闭SELinux

 /etc/init.d/iotables stop    关闭防火墙

编译安装nginx-1.6.3_第5张图片

   再在浏览器中输入192.168.126.133,能够进入,表示nginx启动成功

编译安装nginx-1.6.3_第6张图片