Apache 2.4 reload fails

11,763

It looks like from the error log, you have either misconfigured your virtualhost or duplicate Listen 80 entries in your apache config files.

(98)Address already in use: AH00072: make_sock: could not bind to address vhostIp:vhostPort

In your default virtualhost config file, try changing <VirtualHost *> to <VirtualHost *:80> and restart apache. For a name based virtual host you don't need to specify ip address.

Also check your /etc/apache2/ports.conf file for possible duplicate entry for port declaration.

Update from OP: Problem was solved by deleting a line in the ports.conf <IfModule ssl_module> Listen 443 Listen vpsIp:5673 (line added by Webmin during the failed vhost creation)

Share:
11,763

Related videos on Youtube

ant0nio
Author by

ant0nio

Updated on September 18, 2022

Comments

  • ant0nio
    ant0nio almost 2 years

    My Apache won't reload after doing some changes, in this case after adding a new VHOST via Webmin. It's not the first time it happens, last time I resolved reinstalling Apache, indeed not a satisfactory way to solve the problem.

    In Webmin I get this error

    Failed to start apache :
     :
    Starting apache2 (via systemctl): apache2.service.
    

    So I try to reload Apache manually vis ssh

    This is what happens

    root@myvps:/# /etc/init.d/apache2 reload
    Reloading apache2 configuration (via systemctl): apache2.serviceJob for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details. failed!
    

    So this is the journalctl -xn response

    Jan 04 08:55:51 myvps systemd[1]: Reload failed for LSB: Apache2 web server.
    -- Subject: Unit apache2.service has finished reloading its configuration
    -- Defined-By: systemd
    -- Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit apache2.service has finished reloading its configuration
    --
    -- The result is failed.
    Jan 04 08:56:01 myvps CRON[3403]: pam_unix(cron:session): session opened for user root by (uid=0)
    Jan 04 08:56:01 myvps CRON[3404]: (root) CMD (cd / && run-parts --report /etc/cron.hourly)
    Jan 04 08:56:01 myvps CRON[3403]: pam_unix(cron:session): session closed for user root
    Jan 04 08:56:02 myvps systemd[1]: Reloading LSB: Apache2 web server.
    -- Subject: Unit apache2.service has begun with reloading its configuration
    -- Defined-By: systemd
    -- Support: freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit apache2.service has begun with reloading its configuration
    Jan 04 08:56:02 myvps systemd[1]: Failed to reset devices.list on /system.slice/apache2.service: No such file or directory
    Jan 04 08:56:03 myvps apache2[3420]: Reloading web server: apache2 failed!
    Jan 04 08:56:03 myvps apache2[3420]: Apache2 is not running ... (warning).
    Jan 04 08:56:03 myvps systemd[1]: apache2.service: control process exited, code=exited status=1
    Jan 04 08:56:03 myvps systemd[1]: Reload failed for LSB: Apache2 web server.
    -- Subject: Unit apache2.service has finished reloading its configuration
    -- Defined-By: systemd
    --
    -- Unit apache2.service has finished reloading its configuration
    --
    -- The result is failed.
    

    and this is the systemctl status apache2.service one

    Jan 04 09:23:43 myvps apache2[3819]: Action 'start' failed.
    Jan 04 09:23:43 myvps apache2[3819]: The Apache error log may have more information.
    Jan 04 09:23:43 myvps apache2[3819]: .
    Jan 04 09:23:43 myvps systemd[1]: Started LSB: Apache2 web server.
    -- Subject: Unit apache2.service has finished start-up
    -- Defined-By: systemd
    -- Support: lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit apache2.service has finished starting up.
    --
    -- The start-up result is done.
    Jan 04 09:24:03 myvps systemd[1]: Reloading LSB: Apache2 web server.
    -- Subject: Unit apache2.service has begun with reloading its configuration
    -- Defined-By: systemd
    --
    -- Unit apache2.service has begun with reloading its configuration
    Jan 04 09:24:03 myvps systemd[1]: Failed to reset devices.list on /system.slice/apache2.service: No such file or directory
    Jan 04 09:24:03 myvps apache2[3868]: Reloading web server: apache2 failed!
    Jan 04 09:24:03 myvps apache2[3868]: Apache2 is not running ... (warning).
    Jan 04 09:24:03 myvps systemd[1]: apache2.service: control process exited, code=exited status=1
    Jan 04 09:24:03 myvps systemd[1]: Reload failed for LSB: Apache2 web server.
    -- Subject: Unit apache2.service has finished reloading its configuration
    -- Defined-By: systemd
    --
    -- Unit apache2.service has finished reloading its configuration
    --
    -- The result is failed.
    

    These are the caracteristics of the VPS

    • Debian Linux 8
    • Apache 2.4.10
    • Webmin 1.780
    • Kernel and CPU Linux 2.6.32-042stab108.8 on x86_64
    • BIND 9.9.5

    some others details from the Apache error log:

    [Mon Jan 04 05:16:05.615503 2016] [mpm_event:notice] [pid 367:tid 140186227066752] AH00489: Apache/2.4.10 (Debian) OpenSSL/1.0.1k configured -- resuming normal operations
    [Mon Jan 04 05:16:05.615527 2016] [core:notice] [pid 367:tid 140186227066752] AH00094: Command line: '/usr/sbin/apache2'
    [Mon Jan 04 06:22:05.208150 2016] [core:error] [pid 428:tid 140185949918976] [client clientIP:clientPort] AH00135: Invalid method in request quit
    [Mon Jan 04 08:34:33.316012 2016] [mpm_event:notice] [pid 367:tid 140186227066752] AH00493: SIGUSR1 received.  Doing graceful restart
    (98)Address already in use: AH00072: make_sock: could not bind to address vhostIp:vhostPort
    [Mon Jan 04 08:34:33.343511 2016] [mpm_event:alert] [pid 367:tid 140186227066752] no listening sockets available, shutting down
    [Mon Jan 04 08:34:33.343518 2016] [:emerg] [pid 367:tid 140186227066752] AH00019: Unable to open logs, exiting
    

    my apache2.conf http://pastebin.com/xcedmPi0

    my VirtualHost configurations files 000-default.conf http://pastebin.com/QYgMtTaK

    webmin.conf pastebin.com/wFAe1uyS

    Anybody could help?

    Thanks.

    • Pedro
      Pedro over 8 years
      how about the apache conf?
    • ant0nio
      ant0nio over 8 years
      this is how my apache2.conf looks like: pastebin.com/xcedmPi0
    • Marc Stürmer
      Marc Stürmer over 8 years
      Are you sure about this kernel version? It's really ancient! Debian 8 ships with 3.16 AFAIK!
    • ant0nio
      ant0nio over 8 years
      yes, I double checked that, that's the version that my VPS panel install automatically. Should I change that?
  • ant0nio
    ant0nio over 8 years
    Added the apache2.conf link to the explanation of the problem.I'll look for what you suggest, thanks
  • Mugurel
    Mugurel over 8 years
    It seems that you are declaring the virtual host into a *.conf file within sites-enabled so we'd need that vhost configuration to be able to further assist.
  • ant0nio
    ant0nio over 8 years
    In my webmin.conf I only have the https Vhost: <VirtualHost *:443> and in the default-000.conf I only have one Vhost: <VirtualHost *> I have tryed to add the 80 port specification here but nothing changed
  • Diamond
    Diamond over 8 years
    @ant0nio, you have posted the apache.conf twice, post the virtual hosts configs too.
  • Felix Jen
    Felix Jen over 8 years
    Did Webmin add the new VHost into default-000.conf? Because that's a bit of bad practice. Also, it appears that the virtual host config you posted does not contain a ServerName declaration which could also be part of the problem. Please refer to here for how a name-based VHost set up should look.
  • Diamond
    Diamond over 8 years
    @ant0nio, if you have masked the vhostIp:vhostPortpart in posted log, you should unmask it, then it will be clear which entry/vhost file is causing the issue. Is it 80 or 443? From your config, as I have mentioned already, change <VirtualHost *> to <VirtualHost *:80> add a ServerName entry and also check your ports.conf file.
  • ant0nio
    ant0nio over 8 years
    @bangal you are right, it was the 80 port. It seems I have just resolved the problem thanks to your suggestion. The problem was caused by an entry into the port.conf. A line with vpsIp:5673 into <IfModule ssl_module> tag. Deleting that all works back.
  • ant0nio
    ant0nio over 8 years
    @bangal should I edit the answer? What is the correct form to close the Question? This is what I would write: Problem solved deleting a line into the ports.conf <IfModule ssl_module> Listen 443 Listen vpsIp:5673 (line added by Webmin during the failed vhost creation) </IfModule>
  • ant0nio
    ant0nio over 8 years
    You have been quicker than me. Thank you @bangal ;)
  • We are Borg
    We are Borg almost 8 years
    @bangal : I am having the same problem with systemd, can you please check this question : serverfault.com/questions/797626/… . Thank you.