赞
踩
今天小编在https网站改造时使用“systemctl httpd restart”命令Apache启动失败,输出了如下的错误信息:
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
因为小编的apache服务器之前启动是正常的,后来由于使用“yum install mod_ssl”命令安装apache ssl模块之后再启动httpd服务器就报了上述的错误,于是在网络上大量寻找资料,都没有解决。
后来仔细看了一眼上面的错误信息,发现了“See systemctl status httpd.service”这一句话,于是在控制台运行了“systemctl status httpd”命令,看到了如下这几个关键的错误内容:
[root@VM_219_180_centos conf]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed(Result: exit-code) since Wed 2018-05-23 16:31:04 CST; 13s ago
Docs: man:httpd.service(8)
Process: 8267 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 8267 (code=exited, status=1/FAILURE)
Status: "Reading configuration..."
May 23 16:31:04 VM_219_180_centos systemd[1]: Starting The Apache HTTP Server...
May 23 16:31:04 VM_219_180_centos httpd[8267]: AH00526: Syntax error on line 104 of /etc/httpd/conf.d/ssl.conf:
May 23 16:31:04 VM_219_180_centos httpd[8267]: SSLCertificateFile: file '/etc/pki/tls/certs/localhost.crt' does not exist... empty
May 23 16:31:04 VM_219_180_centos systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
May 23 16:31:04 VM_219_180_centos systemd[1]: Failed to start The Apache HTTP Server.
May 23 16:31:04 VM_219_180_centos systemd[1]: Unit httpd.service entered failed state.
May 23 16:31:04 VM_219_180_centos systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
错误解决:
从上面两行红色的字体可以看出提示,在“/etc/httpd/conf.d/ssl.conf”这个文件里面,有一行数据不存在,也就是“localhost.crt”这个名字的https证书不对,或者路径错误了,因此我们只需要检查ssl.conf这个配置文件里面的信息是否都正确了就可以了。
例如小编就将第二行红色部分改成了“SSLCertificateFile /etc/pki/tls/certs/2_www.tpyyes.com.crt”这样,再运行“systemctl httpd restart”命令重启apache就没有问题了。
注意:这个只是小编的解决方法,虽然都是显示的Apache启动错误(Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.),但是每个人的具体错误内容都是不一样的。
重要的是,我们要记得运行“systemctl status httpd”这个命令来查看我们的错误到底是什么!然后对症下药即可!!!
来源网站:太平洋学习网,转载请注明出处:http://www.tpyyes.com/a/linux/616.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。