Ubuntu18.04安装OpenResty
2023-03-07 09:39:49 时间
安装
根据官网安装页说明
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 就可以了.
相关文章
- 在 Go 里用 CGO?这 7 个问题你要关注!
- 9款优秀的去中心化通讯软件 Matrix 的客户端
- 求职数据分析,项目经验该怎么写
- 在OKR中,我看到了数据驱动业务的未来
- 火山引擎云原生大数据在金融行业的实践
- OpenHarmony富设备移植指南(二)—从postmarketOS获取移植资源
- 《数据成熟度指数》报告:64%的企业领袖认为大多数员工“不懂数据”
- OpenHarmony 小型系统兼容性测试指南
- 肯睿中国(Cloudera):2023年企业数字战略三大趋势预测
- 适用于 Linux 的十大命令行游戏
- GNOME 截图工具的新旧截图方式
- System76 即将推出的 COSMIC 桌面正在酝酿大变化
- 2GB 内存 8GB 存储即可流畅运行,Windows 11 极致精简版系统 Tiny11 发布
- 迎接 ecode:一个即将推出的具有全新图形用户界面框架的现代、轻量级代码编辑器
- loongarch架构介绍(三)—地址翻译
- Go 语言怎么解决编译器错误“err is shadowed during return”?
- 敏捷:可能被开发人员遗忘的部分
- Denodo预测2023年数据管理和分析的未来
- 利用数据推动可持续发展
- 在 Vue3 中实现 React 原生 Hooks(useState、useEffect),深入理解 React Hooks 的