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
    
  • 相关阅读:
    js实现对身份证校验
    zip解压缩
    zip压缩
    文件内容编解码
    文件的操作
    Mysql账号管理
    深度优先算法DFS
    Java常见知识问答
    Hibernate的单向OneToMany、单向ManyToOne
    Angularjs在线编辑器
  • 原文地址:https://www.cnblogs.com/argozhang/p/14878831.html
Copyright © 2011-2022 走看看