我在Xubuntu16.04上的apache在从冬眠中醒来后无法工作。重新启动没有帮助。当我尝试重新启动时,我会得到以下消息:
apache2.service的作业失败,因为控制进程退出时带有错误代码。有关详细信息,请参阅"systemctl状态apache2.service“和”日记-xe“。
尝试systemctl status apache2.service返回
apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Sa 2016-08-20 21:24:49 CEST; 6min ago
Docs: man:systemd-sysv-generator(8)
Process: 6005 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Aug 20 21:24:49 johndoe apache2[6005]: Output of config test was:
Aug 20 21:24:49 johndoe apache2[6005]: [Sat Aug 20 21:24:49.248413 2016] [core:crit] [pid 6015] (EAI 2)Name or service not known: AH00077: alloc_listener: failed to set up sockaddr for localhost
Aug 20 21:24:49 johndoe apache2[6005]: AH00526: Syntax error on line 5 of /etc/apache2/ports.conf:
Aug 20 21:24:49 johndoe apache2[6005]: Listen setup failed
Aug 20 21:24:49 johndoe apache2[6005]: Action 'configtest' failed.
Aug 20 21:24:49 johndoe apache2[6005]: The Apache error log may have more information.
Aug 20 21:24:49 johndoe systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 20 21:24:49 johndoe systemd[1]: Failed to start LSB: Apache2 web server.
Aug 20 21:24:49 johndoe systemd[1]: apache2.service: Unit entered failed state.
Aug 20 21:24:49 johndoe systemd[1]: apache2.service: Failed with result 'exit-code'.上面提到的ports.conf看起来很好(第5行是localhost:80):
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf
Listen localhost:80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet在error.log里找不到什么
发布于 2016-08-22 09:31:09
域名(例如localhost)和IP地址(如127.0.0.1)之间的连接是在/etc/hosts (或本地DNS服务器)中进行的。我认为配置错误是您不能让Apache监听某个域名(例如localhost),但是您必须使用一个IP地址。
要让Apache侦听域名,您必须配置一个VirtualHost (有关说明请参见apache文档 )。
发布于 2016-08-20 20:19:15
好吧,实际上是
Listen localhost:80它必须改为
Listen 80我记得,我曾经将它更改为localhost:80,以限制来自外部的连接。也许因为最近的更新,它不再起作用了?我有Apache/2.4.18
问题是,我现在不能使用localhost作为url,我必须调用127.0.0.1
https://askubuntu.com/questions/814702
复制相似问题