zoukankan      html  css  js  c++  java
  • 源码安装nginx env

    源码安装nginx

    1. For ubuntu:18.04

    apt -y install build-essential libtool libpcre3 libpcre3-dev zlib1g-dev openssl net-tools curl wget
    wget -P /tmp http://nginx.org/download/nginx-1.18.0.tar.gz
    tar -xf /tmp/nginx-1.18.0.tar.gz -C /usr/local/src
    cd /usr/local/src/nginx-1.18.0  && ./configure --prefix=/usr/local/nginx
    make && make insatll
    

    增强性能或功能需要优化或使用其他方案

    2. For Centos7

    yum -y install gcc pcre-devel openssl-devel zlib-devel
    useradd -s /sbin/nologin nginx -M
    wget -P /tmp http://nginx.org/download/nginx-1.18.0.tar.gz
    tar -xf /tmp/nginx-1.18.0.tar.gz -C /usr/local/src
    cd /usr/local/src/nginx-1.18.0
    ./configure --prefix=/usr/local/nginx 
      --user=nginx 
      --group=nginx 
      --with-http_ssl_module 
      --with-http_v2_module 
      --with-http_realip_module 
      --with-http_stub_status_module 
      --with-http_gzip_static_module 
      --with-pcre 
      --with-stream 
      --with-stream_ssl_module 
      --with-stream_realip_module
    make && make install
    chown -R nginx.nginx /usr/local/nginx
    ln -s /usr/local/nginx/sbin/nginx /usr/sbin/
    
    # cat /usr/lib/systemd/system/nginx.service
    [Unit]
    Description=nginx - high performance web server
    Documentation=http://nginx.org/en/docs/
    After=network-online.target remote-fs.target nss-lookup.target
    Wants=network-online.target
    
    [Service]
    Type=forking
    PIDFile=/usr/local/nginx/logs/nginx.pid
    ExecStart=/usr/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    ExecReload=/bin/kill -s HUP $MAINPID
    ExecStop=/bin/kill -s TERM $MAINPID
    
    [Install]
    WantedBy=multi-user.target
    
    # systemctl daemon-reload
    # systemctl enable --now nginx
    

    PS:

    Ubuntu安装Nginx

    CentOS系统安装openresty

  • 相关阅读:
    hdu 1166 敌军布阵
    UVA 100
    dfs和bfs 变形课
    hdu 1002 A + B Problem II
    连连看 杭电1175
    跳格子 DFS 加 奇偶截枝
    c语言 判断两直线段是否相交
    poj 3067 Japan
    数状数组
    UVA 10881 Piotr's Ants
  • 原文地址:https://www.cnblogs.com/firewalld/p/14633050.html
Copyright © 2011-2022 走看看