Apache Config Files

The Layout...


The layout of the config files is distribution dependant so the main config file may be different. My personal preference is Debian which uses a file named apache2.conf as the main config file. However, other distributions use httpd.conf which is also the name of the main executable. Whatever the case may be, there are a slew of files for configuration which are all linked in some way to the main config file.

Pay particular attention to the Include statements. These statements link config files together, in fact, there is a daisy chain effect going on here. For example:

Include conf.d/

Includes all the files located in the /etc/apache2/conf.d directory. By default these would include files like aliases, charset, localized-error-pages, security, etc.

The Include directive is a convenient tool, I use it often. Include is a C thing except in C it's include. It allows you to keep configuration options in seperate files. For example I keep all the main directory settings in a file called directory and include it from the main config file. This file has to be run before the files in conf.d so I keep it in the main appache2 config directory. Otherwise it will get run to late since that directory is included at the end of the main config file.

All configuration files are added from the main configuration file apache2.conf with the Include directive. For example this section includes all the config files in the mods-enabled subdirectory that end in load or conf...

# Include module configuration: Include mods-enabled/*.load Include mods-enabled/*.conf



Also any Vitual Host config files are loaded from the sites-enabled subdirectory.

# Include the virtual host configurations: Include sites-enabled/

CREATED 2012-12-01 17:31:35.0

00-18-93

UPDATED 2012-12-01 18:09:30.0

User Configuration...


User configuration was in the httpd.conf file in past versions, however, this this file is no more. Instead there is a new subdirectory conf.d of which all files are read. This allows you to keep seperate configuration snippets in seperate files by subject.

Since the entire contents of the conf.d directory are read during initialization, user configuration files can be specialized rather than having one large config file.

CREATED 2012-12-01 22:02:20.0

00-18-95

UPDATED 2012-12-01 22:02:27.0


CREATED 2012-12-02 03:17:29.0

00-18-9A

UPDATED 2012-12-02 03:17:29.0

Can not enable a module?


You attempt to enable a module with ...

sudo a2enmod [mod_name]

...and apache returns...

ERROR: Module [mod_name] does not exist!

What to do? First make sure the module is installed. Then go to /usr/lib/apache2/modules where all the apache2 modules live. If the .so file is there you are almost home. Go to /etc/apache2/mods-available and create a .load file. In that file add the load module line.

LoadModule [module_name] [path to modules house]

The path to the modules house is the .so file you found in /usr/share/apahce2/modules. Now the module should load. If no re-trace your steps.

Note: Running a2enmod only places a symlink in the /etc/apache2/mods-enabled directory which loads when apache2 starts up. All the symlinks in that folder are executed to load the perspective modules.

CREATED 2013-01-02 11:03:23.0

00-19-35

UPDATED 2013-01-02 11:03:32.0

Environment Variables...


Environment variables as defined in the envvars config file.

  • APACHE_ARGUMENTS=''
  • APACHE_RUN_USER=www-data
  • APACHE_RUN_GROUP=www-data
  • APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid
  • APACHE_RUN_DIR=/var/run/apache2$SUFFIX
  • APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
  • APACHE_LOG_DIR=/var/log/apache2$SUFFIX
  • APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'
  • LANG=C

CREATED 2017-04-27 23:36:25.0

00-29-BC

UPDATED 2017-04-27 23:36:35.0

Knowledge

L
I
N
K
S

DBID: db.wam

Page Server: Ruger

©2012 Leistware Data Systems

      Hello anonymous