#nginx是一款功能强大、开源软件



1、系统版本和内核版本

        

           [root@node06 ~]# uname -r

              3.10.0-327.el7.x86_64

           [root@node06 ~]# cat /etc/redhat-release 

              CentOS Linux release 7.2.1511 (Core) 

           [root@node06 ~]# 


2、软件包版本  nginx-1.11.10.tar.gz   (包的地址在介绍里)

3、安装依赖

         [root@nginx ~]#  yum install -y gcc  pcre-devel  openssl-devel

4、创建nginx启动用户、需要的目录并解压安装包。

         [root@nginx ~]# useradd nginx

         [root@nginx ~]# mkdir -p /usr、local/nginx/{client,proxy,fastcgi,uwsgi,scgi}

         [root@nginx ~]# tar zxf nginx-1.11.10.tar.gz

         [root@nginx ~]# cd nginx-1.11.10/

5、配置nginx的安装参数和编译

        

[root@nginx nginx-1.11.4]# ./configure \

--prefix=/usr/local/nginx \

--user=nginx \

--group=nginx \

--with-http_ssl_module \

--with-http_flv_module \

--with-http_stub_status_module \

--with-http_gzip_static_module \

--http-client-body-temp-path=/usr/local/nginx/client \

--http-proxy-temp-path=/usr/local/nginx/proxy \

--http-fastcgi-temp-path=/usr/local/nginx/fastcgi \

--http-uwsgi-temp-path=/usr/local/nginx/uwsgi \

--http-scgi-temp-path=/usr/local/nginx/scgi \

--with-pcre \

--with-file-aio \

--with-http_secure_link_module 


[root@nginx nginx-1.11.10]# make && make install


6、验证安装是否成功

     [root@nginx ~]#cd /usr/local/nginx/

       [root@nginx ~]#ls sbin/

        nginx         证明安装成功

7、启动nginx并设置开机自启

     [root@nginx ~]# /usr/local/nginx/sbin/nginx 

     [root@nginx ~]#  vim /etc/rc.d/rc.local

     /usr/local/nginx/sbin/nginx 

     [root@nginx ~]# chmod a+x /etc/rc.d/rc.local   -------> centos7.2需要这一步

8、验证nginx是否正常启动

     打开网页输入       http://<ip地址>

     能看到nginx提供的页面表示安装成功