Centos7 源码安装 Nginx1.18.0

2020-11-14  本文已影响0人  单曲_循环
  1. 源码下载
    wget https://nginx.org/download/nginx-1.18.0.tar.gz

  2. 解压
    tar -zxvf nginx-1.18.0.tar.gz

  3. 安装
    参见 http://nginx.org/en/docs/configure.html
    mkdir /usr/local/nginx
    ./configure
    --sbin-path=/usr/local/nginx/nginx
    --conf-path=/usr/local/nginx/nginx.conf
    --pid-path=/usr/local/nginx/nginx.pid
    --with-http_ssl_module

make && make install

  1. 测试nginx
    /usr/local/nginx/nginx -V

    image.png
  2. nginx 常用命令
    nginx -s quit 优雅停止nginx,有连接时会等连接请求完成再杀死worker进程
    nginx -s reload 优雅重启,并重新载入配置文件nginx.conf
    nginx -s reopen 重新打开日志文件,一般用于切割日志
    nginx -v 查看版本
    nginx -t 检查nginx的配置文件
    nginx -h 查看帮助信息
    nginx -V 详细版本信息,包括编译参数
    nginx -c filename 指定配置文件

P.S 如果make过程有问题请安装依赖

yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel

上一篇 下一篇

猜你喜欢

热点阅读