The Apache HTTP server is installed by default in all Linux distributions and it is configured to run as service. I usually prefer to install Apache from source instead of using the default one. After installing Apache I want to run that instance as service so that it can be restarted automatically whenever machine is rebooted. This can be achieved easily by modifying /etc/rc.d/init.d/httpd file, which is configured to run the Apache installed with OS.
Comment the following section, though it is not required but I prefer to keep all configuration at one place
Modify the following lines-
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
apachectl=/usr/sbin/apachectlto point towards your Apache installation
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd/httpd.pid}
apachectl=/opt/apps/httpd-2.2.14/bin/apachectlNow your custom Apache instance will be started by OS instead of the default one.
httpd=${HTTPD-/opt/apps/httpd-2.2.14/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/opt/apps/httpd-2.2.14/logs/httpd.pid}
2 Comments:
Thanks Vinod, This helped me to auto start installed apache in my current project's production environment.
If you need assistance in writing your assignment, our expert writers will do your homework for you. Our professional writers are trained and qualified to complete any academic task. Our writers understand the importance of academic integrity, so you can be sure that your assignment will be completed with no errors and plagiarism.
Post a Comment