Linux – the difference between apachectl and httpd.worker

apache-2.2linuxprocess

My hosting service, Webfaction, installs apache start scripts for django/python apps automatically. The installed start script is:

#!/bin/bash
LD_LIBRARY_PATH=/home/mertnuhoglu/webapps/dj02/apache2/lib /home/mertnuhoglu/webapps/dj02/apache2/bin/httpd.worker -f /home/mertnuhoglu/webapps/dj02/apache2/conf/httpd.conf -k start

This script starts an httpd.worker instance:

 3364       00:03  8950 /home/mertnuhoglu/webapps/dj02/apache2/bin/httpd.worker

Recently, I followed a tutorial for custom app installation. In this tutorial, start script is defined as:

#!/bin/bash
/home/rocketmonkeys/webapps/django/apache2/bin/apachectl start

This script starts an httpd -k start:

 0.0  1620 17462 /home/mertnuhoglu/webapps/django/apache2/bin/httpd -k start

I would like to ask three things:

  1. What is the difference between these two ways of starting apache server?

  2. In the first script, which executable (httpd.worker or httpd.conf or something else) is run?

  3. Why does httpd instance in the second example has -k start parameter? Is this due to apachectl?

Best Answer

  1. apachectl is a wrapper over httpd and just sets some environment variables and adds further functionality, like configtest, more in detail here. httpd.worker is like httpd but with the worker module enabled.

  2. The first script executes the httpd.worker binary with the httpd.conf configuration file.

  3. Correct, apachectl appends the -k start parameter to httpd