安装完成 Httpd 后出现错误:
[root@vps-f2a02f66 vhosts]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: failed (Result: exit-code) since Sun 2020-05-24 16:56:11 UTC; 12min ago
Docs: man:httpd.service(8)
Process: 17168 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 17168 (code=exited, status=1/FAILURE)
Status: "Reading configuration..."
CPU: 44ms
May 24 16:56:11 vps-f2a02f66.vps.ovh.ca systemd[1]: Starting The Apache HTTP Server...
May 24 16:56:11 vps-f2a02f66.vps.ovh.ca httpd[17168]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using vps-f2a02f66.vps.ovh.ca. Set the 'ServerName' directive globally to suppress this >
May 24 16:56:11 vps-f2a02f66.vps.ovh.ca systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
May 24 16:56:11 vps-f2a02f66.vps.ovh.ca systemd[1]: httpd.service: Failed with result 'exit-code'.
May 24 16:56:11 vps-f2a02f66.vps.ovh.ca systemd[1]: Failed to start The Apache HTTP Server.
服务器的错误提示信息如下:
这是因为你的服务器没设置域名。
你可以设置本地域名后解决这个问题。
编辑 vi /etc/httpd/conf/httpd.conf 文件。
然后修改 ServerName localhost:80 为 localhost 或者取消注释这行。
然后重启服务器后,就可以修正上面的错误。