Tuesday, September 23, 2014

My Apache Experience 2

When I ran
/etc/init.d/apache2 restart
but the simple error was displayed like below
ERROR: apache2 failed to start

Finally, I found a way to find out the failure reason,
/etc/init.d/apache2 -d -v start

From the console output the progress message, 

+ '[' 10 -lt 15 ']'
+ '[' -e /var/run/apache2.pid ']'
+ sleep 1

the startup program will check /var/run/apache2.pid existed or not,
but from the configuration file
/etc/apache2/modules.d/00_mpm.conf
the pid file is stored in /run/apache2.pid

so I modified the configuration file to update the pid file to /var/run.
Retry again /etc/init.d/apache2 and finally it is ok right now.

 * Stopping apache2 ...                                                                                         [ ok ]
 * Starting apache2 ...                                                                                         [ ok ]

Reference:
http://wonkabar.org/2012/09/10/gentoo-openrc-apache-and-monit-proper-starting-and-stopping/

No comments: