Apache Failure on Centos 7 not starting

15,770

Solution 1

You don't need to modify systemd configurations. This is more likely an Apache config error.

You probably need to load the systemd module for apache. In CentOS 7's default httpd config there is a file 00-systemd.conf which is pulled into the apache config using the module include line that has this information. I bet if you load that, you'll find you problem resolved.

$ cat conf.modules.d/00-systemd.conf
# This file configures systemd module:
LoadModule systemd_module modules/mod_systemd.so

This usually occurs if you are copying over a config from another system that doesn't use systemd or perhaps upgrading from Apache 2.2 to Apache 2.4 where that module include directive isn't in the httpd.conf.

Solution 2

I was facing the same error ([core:warn] [pid 10391] AH00098: pid file /var/run/httpd/httpd.pid overwritten -- Unclean shutdown of previous Apache run? ) and I've just solved it by replacing contents of file /usr/lib/systemd/system/httpd.service with:

[Unit] 
Description=The Apache HTTP Server 
After=network.target remote-fs.target nss-lookup.target 

[Service] 
Type=forking 
EnvironmentFile=/etc/sysconfig/httpd 
ExecStart=/usr/sbin/httpd $OPTIONS -k start 
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful 
ExecStop=/usr/sbin/httpd $OPTIONS -k graceful-stop 
PrivateTmp=true 

[Install] 
WantedBy=multi-user.target 

I don't know if it is related to this bug, but I took the answer from there.

Solution 3

1) try starting apache like this:

/usr/sbin/httpd -DFOREGROUND -e debug

and look for a clue on what's stopping it.

2) try looking at Apache's stack backtrace. You can use pstack or gbd for this, or you might need to use mod_backtrace. See more info here under Determing why an apache process hung and Determing why an apache process crashed.

Share:
15,770

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    hellau everyone,

    i have a problem, that i cant resolve alone, so i need your help.

    i have installed on a centos 7 apache when im asking for the status of the service (systemctl status httpd) so i got an error like this one:

    • Starting The Apache HTTP Server...
    • httpd.service operation timed out. Terminating httpd.service stopping timed out (2). Killing
    • Failed to start the Apache HTTP Server
    • Unit httpd.server entered failed state

    i looked up in my error_log file (var/log/httpd/error_log/ and got this here

    • SELinux policy enabled: httpd running as context system_u:system_r:httpd_t:s0
    • suEXEC mechanism enabled (wrap per: /usr/sbin/suexec)
    • generation secret for digest authentification
    • no slotmen from mod_heartmonitor
    • pid file /run/httpd/httpd.pid overwritten -- Unclean shutdown previous Apache run?
    • Apache/2.4.6 (CentOS) PHP/5.4.16. configured -- resuming normal operations
    • Command line: '/usr/sbin/httpd - D FOREGROUND'

    Yes, i have made this work and keyed this error statements, so i have no written the date and the information in []. i hope it is not so importent for resolve this problem.

    i tried this already:

    reboot systemctl --failed (it confirms the failure)

    i havent got any idea. Can someone give my food for thought. Once it started, i tried to install icingaweb2 and now both is not working.

    Thank you very much. mira

  • Michael Hampton
    Michael Hampton over 6 years
    This is a horrible idea. First, read the rest of that bug report to see that it was at best a temporary workaround while they searched for the real problem. Second, read the original httpd.service file to see why you shouldn't do it and what you should do instead.
  • Admin
    Admin almost 5 years
    Thank you! This is on a test server so was playing with having that disabled, sure it started up last time without it!
  • Marc
    Marc over 3 years
    This just saved my day - thanks!