我按照亚马逊的指南来启用https,这是我试图运行的命令:
$ sudo systemctl restart httpd
正如你所看到的,我遇到了这个错误:
Job for httpd.service failed because the control process exited with error code.
See "systemctl status httpd.service" and "journalctl -xeu httpd.service" for details.
为了获得更多信息,我运行了这个命令,得到了这个错误:
$ systemctl status httpd.service
× httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Sun 2023-06-25 08:23:50 UTC; 6min ago
Duration: 36min 11.084s
Docs: man:httpd.service(8)
Process: 29978 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 29978 (code=exited, status=1/FAILURE)
Status: "Reading configuration..."
CPU: 46ms
Jun 25 08:23:49 ---.ec2.internal systemd[1]: Starting httpd.service - The Apache HTTP Server...
Jun 25 08:23:50 ---.ec2.internal systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Jun 25 08:23:50 ---.ec2.internal systemd[1]: httpd.service: Failed with result 'exit-code'.
Jun 25 08:23:50 ---.ec2.internal systemd[1]: Failed to start httpd.service - The Apache HTTP Server.
我读过无数的帖子,人们问同样的问题,但在所有的帖子中,都有一个错误描述(通常端口已经分配,等等)。但由于某种原因,没有任何错误(我可以找到无论如何)在那里。
更多潜在有用信息:
1.我的操作系统是亚马逊Linux 2023
1.我已经检查了语法,它说"语法ok"
1.当我在做任何事情之前运行命令时,它就工作了(就像指南的开头一样)。
连接到您的示例并确认Apache正在运行。
[ec2-user~]$sudo systemctl is-enabled httpd如果返回的值不是"enabled",启动Apache并将其设置为每次系统引导时启动。
[ec2-user~]$sudo systemctl start httpd && sudo systemctl enable httpd
1条答案
按热度按时间pgx2nnw81#
如果你按照错误输出建议用
journalctl -xeu httpd.service
检查错误日志,你可能会找到原因;我的是"httpd: Syntax error on line 358 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.d/laravel.conf: /etc/httpd/conf.d/laravel.conf:8: was not closed."
所以我去纠正了
/etc/httpd/conf.d/laravel.conf
文件和httpd.service is active again中的元素