关于安装Tengine-2.3.2的问题

概述

系统:CentOS 8

软件包:Tengine-2.3.2

安装路径:/usr/local/tengine

脚本路径:/etc/init.d/nginx

脚本部分信息如下:

nginx="/usr/local/tengine/sbin/nginx"

NGINX_CONF_FILE="/usr/local/tengine/conf/nginx.conf"

错误信息:(使用脚本启动报错)

nginx.service: Can't open PID file /var/run/nginx.pid (yet?) after start: No such file or directory

提示没找到/var/run/nginx.pid路径下的PID文件。

解决方法

添加 systemd 启动配置文件

vim /lib/systemd/system/tengine.service

具体配置如下:

[Unit]
Description=The NGINX TTT HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/tengine/logs/nginx.pid
ExecStartPre=/usr/local/tengine/sbin/nginx -t
ExecStart=/usr/local/tengine/sbin/nginx
ExecReload=/usr/local/tengine/sbin/nginx  -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target

添加服务项

chkconfig --add tengine
chkconfig --list

设置开机启动

chkconfig tengine on

启动tengine

systemctl start tengine
service tengine start

后记

start tengine时卡住,可能是由于没有给脚本执行权限,修改如下:

chmod +x /etc/init.d/ngine

或者直接:

chmod 777 /etc/init.d/ngine

参考

https://izhong.me/archives/install-tengine-on-centos

posted @ 2021-01-05 15:42  Yi-Ming  阅读(410)  评论(0)    收藏  举报