Search code examples
linuxapachehttpd.confrhel

Unable to start Apache HTTPD after server reboot


unable to start Apache HTTPD after server reboot. We have /etc/httpd/conf/ owned by func. user/group. Hence we use scripts to start httpd.conf and every time server reboots, we are unable to start HTTPD. We found that /var/run/httpd is getting changed to apache/root after reboot. Hence script fails to start the HTTPD which is under func. user/group.

Please help me !!!


Solution

  • Use the DefaultRuntimeDir directive to override the default "/run/httpd" directory. This goes in httpd.conf. For example:

    DefaultRuntimeDir  "/my/local/rundir"
    

    This will cause apache to create "/my/local/rundir/authdigest_shm.1234"

    For some reason this doesn't also override the default pid file directory, so set it with the PidFile directive, e.g.:

    PidFile "/my/local/rundir/httpd.pid"
    

    Use /my/local/rundir/ location to your location which contains user/group permission.If you dont want to change location then you can use below configuration in /usr/lib/tmpfiles.d/httpd.conf

    d /var/run/httpd   700 myuser mygroup
    d /var/run/httpd/htcacheclean   700 myuser mygroup