【发布时间】:2021-10-15 00:41:21
【问题描述】:
"systemctl 启用 openresty"
我得到了什么
通过 /lib/systemd/systemd-sysv-install 与 SysV 服务脚本同步 openresty.service 的状态。
执行:/lib/systemd/systemd-sysv-install enable openresty
无法重新加载守护进程:访问被拒绝
无法重新加载守护进程:访问被拒绝
无法启用单元:访问被拒绝
这是截图
systemctl status openresty
openresty.service - NGINX HTTP 和反向代理服务器
已加载:已加载(/lib/systemd/system/openresty.service;已启用;供应商预设:已启用)
活动:自 2021 年 8 月 11 日星期三 17:01:13 UTC 以来失败(结果:退出代码); 2 小时 37 分钟前
进程:8875 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=203/EXEC)
8 月 11 日 17:01:13 instance-2 systemd{1]:启动 NGINX HTTP 和反向代理服务器...
8 月 11 日 17:01:13 instance-2 systemd[8875]:openresty.service:执行命令失败:没有这样的文件或目录
8 月 11 日 17:01:13 instance-2 systemd[8875]:openresty.service:执行步骤失败,生成 /usr/sbin/nginx:没有这样的文件或目录
8 月 11 日 17:01:13 instance-2 systemd(1]: openresty.service: 控制进程退出,code=exited, status=203/EXEC
8 月 11 日 17:01:13 instance-2 systemd(1]: openresty.service: 失败,结果为“exit-code”。
8 月 11 日 17:01:13 instance-2 systemd(1]: 无法启动 NGINX HTTP 和反向代理服务器。
journalctl -u openresty
-- 日志从 2021 年 8 月 10 日星期二 17:42:07 UTC 开始,到 2021 年 8 月 11 日星期三 19:20:05 UTC 结束。 --
8 月 10 日 19:14:22 instance-2 systemd(1]: 启动 OpenResty 应用平台...
8 月 10 日 19:14:22 instance-2 systemd(1]:启动 OpenResty 应用平台。
8 月 10 日 22:00:10 instance-2 systemd(1]: 停止 OpenResty 应用平台...
8 月 10 日 22:00:10 instance-2 systemd(1]: openresty.service: 成功。
8 月 10 日 22:00:10 instance-2 systemd(1]: 停止了 OpenResty 应用程序平台。
8 月 10 日 22:00:10 instance-2 systemd(1]: 启动 OpenResty 应用平台...
8 月 10 日 22:00:10 instance-2 nginx[4012]: nginx: [emerg] 指令“server_name”未由“;”终止在 /etc/openresty/sites-enabled/m.facebook.com.conf:7
8 月 10 日 22:00:10 instance-2 nginx[4012]: nginx: 配置文件 /usr/local/openresty/nginx/conf/nginx.conf 测试失败
8 月 10 日 22:00:10 instance-2 systemd(1]: openresty.service: 控制进程退出,code=exited, status=1/FAILURE
8 月 10 日 22:00:10 instance-2 systemd(1]: openresty.service: 失败,结果为“exit-code”。
8 月 10 日 22:00:10 instance-2 systemd(1]: 无法启动 OpenResty 应用平台。
8 月 10 日 22:01:15 instance-2 systemd(1]: 启动 OpenResty 应用平台...
8 月 10 日 22:01:15 instance-2 nginx[4034]: nginx: [emerg] 指令“server_name”未由“;”终止在 /etc/openresty/sites-enabled/m.facebook.com.conf:7
8 月 10 日 22:01:15 instance-2 nginx[4034]: nginx: 配置文件 /usr/local/openresty/nginx/conf/nginx. conf 测试失败
8 月 10 日 22:01:15 instance-2 systemd(1]: openresty.service: 控制进程退出,code=exited, status=1/FAILURE
8 月 10 日 22:01:15 instance-2 systemd(1]: openresty.service: 失败,结果为“exit-code”。
8 月 10 日 22:01:15 instance-2 systemd(1]: 无法启动 OpenResty 应用平台。
8 月 11 日 17:01:13 instance-2 systemd(1]: 启动 NGINX HTTP 和反向代理服务器...
8 月 11 日 17:01:13 instance-2 systemd[8875]:openresty.service:执行命令失败:没有这样的文件或目录
8 月 11 日 17:01:13 instance-2 systemd[8875]: openresty.service: 在步骤 EXEC spawning / usr /sbin / nginx 时失败:没有这样的文件或目录
8 月 11 日 17:01:13 instance-2 systemd(1]: openresty.service: 控制进程退出,code=exited, status=203/EXEC
8 月 11 日 17:01:13 instance-2 systemd(1]: openresty.service: 失败,结果为“exit-code”。
8 月 11 日 17:01:13 instance-2 systemd(1]: 无法启动 NGINX HTTP 和反向代理服务器。
【问题讨论】:
-
尝试以 root 身份,或使用 sudo。
sudo systemctl enable openresty. -
@SYN 好的,谢谢你能不能也请你帮我解决这个
sudo systemctl start openrestyopenresty.service 的工作失败,因为控制过程以错误代码退出。详见“systemctl status openresty.service”和“journalctl -xe”。 -
您能否编辑您的初始帖子,包括
systemctl status openresty和journalctl -u openresty(或journalctl -xe)的输出? -
@SYN 完成,我已编辑
-
上面写着
Failed at step EXEC spawning /usr/sbin/nginx: No such file or directory。以前的日志提到配置错误... nginx 仍然安装吗?你的 nginx 配置有效吗?