温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

centos7.2下部署nginx

发布时间:2020-04-14 21:38:22 来源:网络 阅读:506 作者:北冥有大鱼 栏目:建站服务器

#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提供的页面表示安装成功






向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI