Apache Configuration File Walk Through
General Information
Explanation of major sections in the Apache Configuration file.
Main Config File
- Default Location: /etc/httpd/conf/httpd.conf
Important config file default directives
- ServerRoot “/etc/httpd” → Where to look for web server configuration. Other config files are relative to this directory.
- Listen 80 → Listen on tcp port 80 (on all available addresses by default)
- Include conf.modules.d/*.conf → Load all of these Dynamic Shared Objects configuration files
- Include conf.d/*.conf → Include additional configuration files (usually virtual hosts files are located here)
- User apache → Default username the httpd process runs as
- Group apache → Default group the httpd process runs as
- DocumentRoot “/var/www/html” → Location of web documents (web pages, etc).
- Directory blocks (<Directory>)→ Define configuration items such as access permissions within the start/end blocks
- AllowOverride → If “None”, the contents of .htaccess files will NOT be read
- Options → Specify different options such as “Indexes” (show directory listing if no index.html file exists)
- Require all → “granted” allows contents of the directory to be accessed. “denied” denies access to the contents.
- IfModule → Only apply the containing settings if a module exists
- Files “.ht” → Settings for certain files. In this case, any “*.ht” files.
- Typically used to restrict access to viewing certain files on the web.
- ErrorLog “logs/error_log” → Location of the main error log file