Apache httpd configuration: sysconfig/apache2 and apache2/httpd.conf

apache-2.4httpd.conf

I'm new to Apache and Linux, and I'm reading through httpd.conf. I've come to a line in default-server.conf where it says:

# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# To disable it, simply remove userdir from the list of modules in APACHE_MODULES
# in /etc/sysconfig/apache2.
#

What's the relation between that file and the httpd.conf file (and the others possibly included by that) inside /etc/apache2/? I'm more concerned about modules, but a general explanation would help.

Best Answer

https://httpd.apache.org/docs/2.4/configuring.html

Apache HTTP Server is configured by placing directives in plain text configuration files. The main configuration file is usually called httpd.conf. The location of this file is set at compile-time and some distributions may elect to use a different name. Also the configuration file name may be overridden at start up with the -f command line flag.

The configuration file is parsed from top to bottom in sequence, and usually the order of directives matters.

In addition, other configuration files may be added using the Include and IncludeOptional directives in the http.conf, and wildcards * can be used to include many configuration files. Include files themselves may also contain the Include directive.

Included files will be merged with the main httpd.conf at the locations of the Include directives.

Any directive may be placed in any of these configuration files. Changes to the main configuration files are only recognized by httpd when it is started or restarted.

A fairly typical httpd.conf looks something akin to this:

# httpd.conf
Directives
...

IncludeOptional early-includes/*.conf

More Directives
...

IncludeOptional late-includes/*.conf

Even More Directives

IncludeOptional active-virtualhosts/*.conf

where any/all *.conf files are included in lexicological order.

I think your /etc/sysconfig/apache2 is not a httpd.conf file nor an Include , usually such /etc/sysconfig/ files are sourced by a start-up script and used set commandline parameters and options.