zoukankan      html  css  js  c++  java
  • Ubuntu18.04安装OpenResty

    安装

    根据官网安装页说明

    http://openresty.org/en/linux-packages.html

    # 这三个包已经存在, 所以新安装为0
    apt install --no-install-recommends wget gnupg ca-certificates
    # 清理了一下之前升级留下来的文件
    apt autoremove
    # key
    wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
    # 安装依赖
    apt install --no-install-recommends software-properties-common
    # 将OpenResty添加到软件源
    add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"
    # 安装OpenResty, 未安装默认自带的open和resty-doc
    apt install --no-install-recommends openresty
    

    安装完后, 服务会自动启动

    修改工作目录

    需要将工作目录转移到 /opt/openresty

    cd /opt
    # 首先将工作目录(包含权限)复制过去, 注意 -p 参数, 用于复制权限
    cp -rp /usr/local/openresty/nginx/ .
    # 修改目录名
    mv nginx/ openresty
    

    修改systemd服务文件, 修改完的内容是这样的, 需要修改的三处: pid路径, 启动增加 -p 工作目录路径 和 -c 配置文件路径.

    # Stop dance for OpenResty
    # =========================
    #
    # ExecStop sends SIGSTOP (graceful stop) to OpenResty's nginx process.
    # If, after 5s (--retry QUIT/5) nginx is still running, systemd takes control
    # and sends SIGTERM (fast shutdown) to the main process.
    # After another 5s (TimeoutStopSec=5), and if nginx is alive, systemd sends
    # SIGKILL to all the remaining processes in the process group (KillMode=mixed).
    #
    # nginx signals reference doc:
    # http://nginx.org/en/docs/control.html
    #
    [Unit]
    Description=full-fledged web platform
    After=network.target
    
    [Service]
    Type=forking
    PIDFile=/opt/openresty/logs/nginx.pid
    ExecStartPre=/usr/local/openresty/nginx/sbin/nginx -t -q -g 'daemon on; master_process on;' -p /opt/openresty -c /opt/openresty/conf/nginx.conf
    ExecStart=/usr/local/openresty/nginx/sbin/nginx -g 'daemon on; master_process on;' -p /opt/openresty -c /opt/openresty/conf/nginx.conf
    ExecReload=/usr/local/openresty/nginx/sbin/nginx -g 'daemon on; master_process on;' -s reload -p /opt/openresty -c /opt/openresty/conf/nginx.conf
    ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /opt/openresty/logs/nginx.pid
    TimeoutStopSec=5
    KillMode=mixed
    
    [Install]
    WantedBy=multi-user.target
    

     然后 systemctl daemon-reload , systemctl restart openresty 就可以了.

  • 相关阅读:
    递归函数之阶乘和字符串反转-基于R和Python
    ERROR getting 'android:label' attribute: attribute is not a string value
    CefGlue 学习杂记
    WinDbg 解决Font.ToLogFont AccessViolationExcetion
    使用ActivityManager的forceStopPackage方法结束进程
    (转) lucene+paoding亲密接触
    (转)Lucene中文分词图解
    (转)实战 Lucene,第 1 部分: 初识 Lucene
    Python时间戳的使用
    Andriod中Style/Theme原理以及Activity界面文件选取过程浅析
  • 原文地址:https://www.cnblogs.com/milton/p/12628190.html
Copyright © 2011-2022 走看看