zoukankan      html  css  js  c++  java
  • CentOS 安装 nginx 教程

    CentOS 安装 nginx 教程

    下载安装包

    cd /usr/local
    wget http://nginx.org/download/nginx-1.19.8.tar.gz
    

    安装依赖

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

    解压缩安装包

    tar -zxvf nginx-1.19.8.tar.gz
    cd /usr/local/nginx-1.19.8/
    

    编译执行

    ./configure --with-http_ssl_module
    make
    make install
    

    删除解压包

    cd ..
    rm -fr nginx-1.19.8
    

    建立快捷方式

    ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx -f
    

    安装服务

    cd /usr/lib/systemd/system/
    vi nginx.service
    
    [Unit]
    Description=nginx - high performance web server
    Documentation=http://nginx.org/en/docs/
    After=network.target remote-fs.target nss-lookup.target
      
    [Service]
    Type=forking
    PIDFile=/usr/local/nginx/logs/nginx.pid
    ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
    ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    ExecReload=/bin/kill -s HUP $MAINPID
    ExecStop=/bin/kill -s QUIT $MAINPID
    PrivateTmp=true
      
    [Install]
    WantedBy=multi-user.target
    
    1. 激活服务
    systemctl enable nginx
    
    1. 启动服务
    systemctl start nginx
    
  • 相关阅读:

    《银行》
    动画
    定位
    浮动
    《css的总结》
    Java的Debug调试
    Eclipse "Unable to install breakpoint due to missing line number attributes..."
    解决 Tomcat Server in Eclipse unable to start within 45 seconds 不能启动的问题
    Java下载文件(流的形式)
  • 原文地址:https://www.cnblogs.com/argozhang/p/14878831.html
Copyright © 2011-2022 走看看