Linux – What role does the /etc/sysconfig/httpd config file have in the configuration of Apache server

apache-http-serverlinux

My linux distribution has a file /etc/sysconfig/httpd that appears to be related to the configuration of Apache server

Can anyone explain what role this plays in the configuration and why it differs from the role the standard httpd.conf configuration file has – why are there two configuration files?

Best Answer

This is distribution dependent. I have CentOS (a clone of RedHat advanced server) and i have this file.

When you start your machine, the init process looks at a bunch of scripts to see what to start. One may be httpd (you can configure apache to start or not with chkconfig). If you look at your /etc/init.d/httpd script, you can see that it checks for /etc/sysconfig/httpd and if so sources it (as if it was a part of the current script). So now any variable definitions in /etc/sysconfig/httpd get applied for the rest of the script.

The examples you see in the file are to set HTTPD, which is a variable set to the executable name. In my distro, by default you use the old prefork module, but you can set to use the multithreaded /usr/sbin/httpd.worker here if you like. You can also set OPTIONS, which are command line options given to httpd (a.k.a. $HTTPD). There really isn't anything else you can set (you can ignore HTTPD_LANG, if you don't know if you need it, you don't need it)

So, if you want the multithreaded server, set HTTPD=/usr/sbin/httpd.worker. This probably won't break anything in the default apache, though some add-ons that you add may (but unlikely) break under multithreaded apache.

Related Question