zoukankan      html  css  js  c++  java
  • CentOS 7 源代码安装Nginx

      本篇简要介绍CentOS 7 源代码安装Nginx。

    Preface

    # yum install epel-release -y
    # yum group install "Development Tools" -y    # 安装基本编译工具

    安装依赖

      Nginx依赖如下三个库:

    • PCRE (for the HTTP Rewrite module)
    • Zlib (for the HTTP Gzip module)
    • OpenSSL (for HTTPS protocol support)

    # yum install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel -y

    安装Nginx

      官网下载您想安装的Nginx版本,如当前最新版本nginx-1.17.6。

    # wget http://nginx.org/download/nginx-1.17.6.tar.gz
    # tar -xvf nginx-1.17.6.tar.gz
    # cd nginx-1.17.6/
    # ./configure
    # make
    # make install
    # /usr/local/nginx/sbin/nginx -v      # nginx默认安装位置/usr/local/nginx
    nginx version: nginx/1.17.6

    创建软连接

    # ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
    # nginx -v
    nginx version: nginx/1.17.6
    # which nginx
    /usr/bin/nginx

    常用命令

    # systemctl start nginx     # 启动
    # systemctl status nginx    # 查看状态
    # systemctl stop nginx      # 停止
    # nginx -s reload           # 重载配置
    # nginx -t                  # 测试配置是否正确
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

    以上!

  • 相关阅读:
    模版
    列表项模版
    vue eventBus 跳坑的办法
    vue适配移动端px自动转化为rem
    pc端,移动端css重置样式
    vue全局引入scss文件(推荐)
    vue安装scss,并且全局引入
    mapState
    通俗易懂的vuex-demo
    ve2.0 v-for循环报错的解决方案
  • 原文地址:https://www.cnblogs.com/Hi-blog/p/Build-Nginx-From-Source-On-CentOS7.html
Copyright © 2011-2022 走看看