CentOS安装Nginx

一、gcc安装

    yum -y install gcc-c++


二、pcre pcre-devel安装

    yum -y install pcre pcre-devel


三、zlib安装

    yum -y install zlib zlib-devel


四、openSSL安装

    yum -y install openssl openssl-devel



五、下载Nginx安装包

    wget http://安装包地址


六、解压

    tar -zxvf nginx-1.11.1.tar.gz

    cd nginx-1.11.1


七、配置 (使用默认配置即可)

    ./configure

    #如果需要其它组件

    ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-http_ssl_module --with-stream


八、编译安装

    >make

    >make install


九、启动、停止nginx

    cd /usr/local/nginx/sbin/

    ./nginx        #启动

    ./nginx -s stop    #停止

    ./nginx -s quit    #退出

    ./nginx -s reload   #重启


十、设置开机启动

    vim /etc/rc.local

    添加一行:/usr/local/nginx/sbin/nginx

    chmod -R 755 /etc/rc.local


十一、测试,成功!

版权声明: 此文为本站源创文章[或由本站编辑从网络整理改编],
转载请备注出处:
[狂码一生] https://www.sindsun.com/articles/23/48
[若此文确切存在侵权,请联系本站管理员进行删除!]


--THE END--