0

My apache on xubuntu 16.04 is not working after waking up from hibernation. Reboot didnt help. When I try to restart I get the following message:

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

trying systemctl status apache2.service returns

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'.

The mentioned ports.conf looks fine (line 5 is Listen 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

And there is nothing to find in the error.log

  • @user577728 could you please post your ` /etc/hosts ` and ` sudo netstat -tplan | grep apache2 ` report . – Khimananda Oli Oct 25 '18 at 14:57
0

ok it was actually the

Listen localhost:80

it must be changed to

Listen 80

I remember, that I once changed it to localhost:80 to restrict the connection from outside. Maybe its not workng any longer because of an recent update? I have Apache/2.4.18

problem is, that I cant use localhost as url now, I have to call 127.0.0.1

  • can the problem be the result of an apache update? – user577728 Aug 20 '16 at 20:25
0

The connection between domain names (such as localhost) and IP addresses (such as 127.0.0.1) is made in /etc/hosts (or in your local DNS server). I think the configuration error is that you can't make Apache listen on a domain name (e.g. localhost), but you must use an IP address.

To make Apache listen on a domain name, you have to configure a VirtualHost (see the apache docs for an explanation).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy