Apache 启动错误

安装Apache的时候总是启动不起来,查看日志报的是

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since 一 2019-05-06 00:48:38 CST; 7s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 7921 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 7920 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 7920 (code=exited, status=1/FAILURE)

5月 06 00:48:28 hantao.centos.minimal systemd[1]: Starting The Apache HTTP Server...
5月 06 00:48:38 hantao.centos.minimal httpd[7920]: [Mon May 06 00:48:38.323438 2019] [core:error] [pid 7920] (EAI 2)Name or...oring!
5月 06 00:48:38 hantao.centos.minimal httpd[7920]: AH00526: Syntax error on line 1 of /etc/httpd/conf.d/tiki.conf:
5月 06 00:48:38 hantao.centos.minimal httpd[7920]: Missing address for VirtualHost
5月 06 00:48:38 hantao.centos.minimal systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
5月 06 00:48:38 hantao.centos.minimal kill[7921]: kill: cannot find process ""
5月 06 00:48:38 hantao.centos.minimal systemd[1]: httpd.service: control process exited, code=exited status=1
5月 06 00:48:38 hantao.centos.minimal systemd[1]: Failed to start The Apache HTTP Server.
5月 06 00:48:38 hantao.centos.minimal systemd[1]: Unit httpd.service entered failed state.
5月 06 00:48:38 hantao.centos.minimal systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

运行

# apachectl configtest
Name or service not known: AH00547: Could not resolve host name *: -- ignoring!
AH00526: Syntax error on line 1 of /etc/httpd/conf.d/tiki.conf:
Missing address for VirtualHost

原来是配置文件写错了,上面明确表示出了那个配置文件出了错,是**/etc/httpd/conf.d/tiki.conf**,它的内容是

<VirtualHost *:80>
        ServerName localhost
        DocumentRoot /var/www/tiki-18.2/
        ErrorLog "/var/www/tiki/error_log"
        TransferLog "/var/www/tiki/access_log"

        <Directory /var/www/tiki-18.1/>
                Options FollowSymLinks Indexes
                Require all granted
                AllowOverride All
                allow from all
        </Directory>
</VirtualHost>

提示中报的是第一行……很奇怪哪里错了,对比了其他的配置文件,我怀疑是第一行必须是注释的空行,也就是

# 
<VirtualHost *:80>
        ServerName localhost
        DocumentRoot /var/www/tiki-18.2/
        ErrorLog "/var/www/tiki/error_log"
        TransferLog "/var/www/tiki/access_log"

        <Directory /var/www/tiki-18.1/>
                Options FollowSymLinks Indexes
                Require all granted
                AllowOverride All
                allow from all
        </Directory>
</VirtualHost>

再测试一下

# apachectl configtest
Syntax OK
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值