![Vagrant + CentOS 7 - Apache 无法启动,我没有看到错误](https://linux22.com/image/69924/Vagrant%20%2B%20CentOS%207%20-%20Apache%20%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%EF%BC%8C%E6%88%91%E6%B2%A1%E6%9C%89%E7%9C%8B%E5%88%B0%E9%94%99%E8%AF%AF.png)
我花了一些时间尝试配置一个从 CentOS 7 基础盒子运行的 Vagrant 盒子。
全新安装 Apache 后,我可以访问服务器http
并重新启动服务器,但是一旦添加虚拟主机,https
我就会遇到错误。这是我的虚拟主机的示例:
<VirtualHost *:80>
ServerName example.example.com
DocumentRoot /var/www/example.example.com/web
ErrorLog /var/www/example.example.com/error.log
CustomLog /var/www/example.example.com/requests.log combined
</VirtualHost>
<VirtualHost *:443>
# Admin email, Servername, and ailases
ServerAdmin [email protected]
ServerName example.example.com
#Index file and document root
DirectoryIndex index.php
DocumentRoot /var/www/example.example.com/web
#SSL certs
SSLCertificateFile /etc/httpd/ssl/example.example.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/example.example.com.key
#Log locations
LogLevel warn
ErrorLog /var/log/httpd/example.example.com/error.log
CustomLog /var/log/httpd/example.example.com/requests.log combined
</VirtualHost>
这就是我跑步时得到的结果apachectl restart
:
Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.
所以很自然地,我按照指示执行并运行systemctl status httpd.service
,输出如下:
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
Active: failed (Result: exit-code) since Wed 2015-07-29 00:56:20 UTC; 40s ago
Process: 21318 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Process: 21317 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 21317 (code=exited, status=1/FAILURE)
Status: "Total requests: 11; Current requests/sec: 0; Current traffic: 0 B/sec"
Jul 29 00:56:20 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Jul 29 00:56:20 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jul 29 00:56:20 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
Jul 29 00:56:20 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
我没有看到任何实际错误,它只是失败了。
编辑:我的apachectl -t
输出被要求:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Syntax OK