centos7.2 nginx-1.13.7安装概要

1. 直接下载.tar.gz安装包,地址:https://nginx.org/en/download.html, 下载nginx-1.13.7.tar.gz

    使用wget命令下载  

            wget -c http://nginx.org/download/nginx-1.13.7.tar.gz

2. 解压 

           [[email protected] tools]# tar -zxvfnginx-1.13.7.tar.gz

3. 进入解压后的目录

           [[email protected] tools]# cd nginx-1.13.7

4.编译安装

            [[email protected] nginx-1.13.7]# ./configure

            [[email protected] nginx-1.13.7]# make

            [[email protected] nginx-1.13.7]# make install

5. 开端口

            [[email protected]  nginx-1.13.7]# firewall-cmd --state

                not running

            [[email protected]  nginx-1.13.7]# service firewalld restart

                Redirecting to /bin/systemctl restart  firewalld.service

            [[email protected]  nginx-1.13.7]# firewall-cmd --zone=public--add-port=80/tcp --permanent

                success

            [[email protected]  nginx-1.13.7]# firewall-cmd --permanent--list-port

                80/tcp 

            [[email protected]  nginx-1.13.7]# service firewalld restart

                Redirecting to /bin/systemctl restart  firewalld.service

            [[email protected]  nginx-1.13.7]# systemctl stopfirewalld.service


6. 启动,关闭nginx

  

查看安装位置:[[email protected]  nginx-1.13.7]# whereis nginx

nginx: /usr/local/nginx

[[email protected]  nginx-1.13.7]# cd /usr/local/nginx/sbin/

启动:[[email protected]  sbin]# ./nginx

停止:[[email protected]l  sbin]# ./nginx -s stop

7. 安装过程中,有可能需要安装依赖项:

   yum install -y pcre pcre-devel
   yum install -y zlib zlib-devel

   yum install -y openssl openssl-devel


8. 命令执行顺序一般如下:

  

    tar -zxvf nginx-1.13.7.tar.gz

    cd nginx-1.13.7

    yum install -y pcre pcre-devel

    yum install -y zlib zlib-devel

    yum install -y openssl openssl-devel

    ./configure

    make

    make install

    firewall-cmd --state

    service firewalld restart

    firewall-cmd --zone=public --add-port=80/tcp--permanent

    firewall-cmd --permanent --list-port

    service firewalld restart

    systemctl stop firewalld.service

    ps aux|grep nginx

    whereis nginx

    cd /usr/local/nginx/sbin/

    ./nginx

    ./nginx-s stop


参考:http://www.linuxidc.com/Linux/2016-09/134907.htm
         http://www.linuxidc.com/Linux/2016-08/134450.htm



文章来源: centos7.2 nginx-1.13.7安装概要

人吐槽 人点赞

猜你喜欢

发表评论

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:centos7.2 nginx-1.13.7安装概要