zoukankan      html  css  js  c++  java
  • centos7下编译安装nginx-1.16.0

    一、下载nginx源码

    http://nginx.org/en/download.html
    

    如:nginx-1.16.0.tar.gz

    二、创建用户和组,并解压

    groupadd www
    useradd -g www www
    tar xf nginx-1.16.0.tar.gz
    

      

    三、下载openssl,编译高版本openssl

    https://www.openssl.org/source/
    

    如:openssl-1.0.2r.tar.gz

    tar xf openssl-1.0.2r.tar.gz
    

      

    四、编译安装nginx

    cd nginx-1.16.0
    
    ./configure --prefix=/data/nmp/nginx 
    --user=www 
    --group=www 
    --with-pcre 
    --with-openssl=/data/openssl-1.0.2r 
    --with-http_ssl_module 
    --with-http_v2_module 
    --with-http_realip_module 
    --with-http_addition_module 
    --with-http_sub_module 
    --with-http_dav_module 
    --with-http_flv_module 
    --with-http_mp4_module 
    --with-http_gunzip_module 
    --with-http_gzip_static_module 
    --with-http_random_index_module 
    --with-http_secure_link_module 
    --with-http_stub_status_module 
    --with-http_auth_request_module 
    --with-http_image_filter_module 
    --with-http_slice_module 
    --with-mail 
    --with-threads 
    --with-file-aio 
    --with-stream 
    --with-mail_ssl_module 
    --with-stream_ssl_module 
    

    --with-openssl 的路径设置为第3步中openssl源码解压路径。

    上面的有些模块大家可以按需安装。

    make -j8 && make install
    

      

    五、配置systemd服务

    创建 nginx.service 文件

    vi /usr/lib/systemd/system/nginx.service
    
    [Unit]
    Description=The nginx HTTP and reverse proxy server
    After=syslog.target network.target remote-fs.target nss-lookup.target
    
    [Service]
    Type=forking
    ExecStartPre=/data/nmp/nginx/sbin/nginx -t
    ExecStart=/data/nmp/nginx/sbin/nginx -c /data/nmp/nginx/conf/nginx.conf
    ExecReload=/data/nmp/nginx/sbin/nginx -s reload
    ExecStop=/data/nmp/nginx/sbin/nginx -s stop
    PrivateTmp=true
    
    [Install]
    WantedBy=multi-user.target
    

    启用 nginx.service

    systemctl enable nginx.service
    

    启动 nginx

    systemctl start nginx.service
    

      

     六、设置firewalld防火墙,开放80端口

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

      

  • 相关阅读:
    “C语言” 读书札记(七)之[自白]
    代码审查就是在排大便——你懂的!
    page事件顺序(.net2.0)
    ASP.NET Custom Error Pages (asp.net自定义错误页)
    26字母中文第一字母排序
    16.448.10
    江西师范大学失物招领网(beta1)版告一段落
    处理HTML代码的若干函数
    Understanding the Session Object in ASP.NET 2.0
    获得扩展名[.net2.0]
  • 原文地址:https://www.cnblogs.com/jkko123/p/10790816.html
Copyright © 2011-2022 走看看