Oct 16, 2020 After that command succeeds, you then must reload Apache (which will only reload the configuration files, not restart the web server) with the command: sudo systemctl reload apache2. There are different ways to locate configuration file. Apache is, by default, installed in /etc/httpd directory. But this path also depends on how apache has been compiled. Default configuration file name httpd.conf.
Apache Web Server Configuration File Download
Apache web server read its configuration file every time it's started. The configuration file is stored in plain text format and Apache will need to be restarted every time there are changes in the configuration file for the changes to take effect.
Location of Apache's main configuration file is set during compile time and differ between distributions. The configuration will be splitted into multiple files for ease of management and separation of concern and will then be called from the main configuration file using Include and IncludeOptional directives .
The.htaccess file in Apache is a tool that allows configurations at the directory and subdirectory level. Htaccess enables you to configure website permissions without altering server configuration files. This tutorial will show you how to set up and enable htaccess on Apache. The Apache’s user and the group can be modified by changing the User and Group directives in the Apache configuration file. Retain the Apache server-info disabled: The server-info directive in the configuration file is by default enabled. This lists details of the Apache configuration when /sever-info page is accessed.
Apache Web Server Configuration File Download
You can always check the location of the main configuration file by running the Apache binary for your distribution with the -V option and then look for the SERVER_CONFIG_FILE value.
Combine the output for both HTTPD_ROOT and SERVER_CONFIG_FILE If the output doesn't provide absolute full path of the configuration file.
Default Apache configuration location
Location of Apache main configuration file is different for most distributions and they would split the configuration files for ease of management. The following table lists how the configuration file is managed for different distributions:
Option | Debian, Ubuntu | openSUSE and SLES | Fedora Core, CentOS, RHEL | macOS | homebrew | xampp |
---|---|---|---|---|---|---|
Base directory | /etc/apache2/ | /etc/apache2/ | /etc/httpd/ | /private/etc/apache2/ | /usr/local/etc/httpd/ | {installation directory}/apache/conf/ |
Main configuration | apache2.conf | httpd.conf | conf/httpd.conf | httpd.conf | httpd.conf | httpd.conf |
ServerRoot | apache2.conf | n/a | conf/httpd.conf | httpd.conf | httpd.conf | httpd.conf |
DocumentRoot | sites-enabled/*.conf | default-server.conf | conf/httpd.conf | httpd.conf | httpd.conf | httpd.conf, extra/httpd-ssl.conf |
VirtualHost | sites-enabled/*.conf | vhosts.d/*.conf | conf/httpd.conf | httpd.conf, other/*.conf | httpd.conf | httpd.conf, extra/httpd-ssl.conf |
LoadModule | mods-enabled/*.load | loadmodule.conf | conf.modules.d/*.conf | httpd.conf, extra/*.conf | httpd.conf | httpd.conf, extra/*.conf |
Log | apache2.conf, sites-enabled/*.conf | httpd.conf, vhosts.d/*.conf | conf/httpd.conf | httpd.conf | httpd.conf | httpd.conf |
User / Group | apache2.conf, envvars | uid.conf | conf/httpd.conf | httpd.conf | httpd.conf | httpd.conf |
Apache Web Server Configuration File Directive Determines If Ssl Is Enabled
Path for files and directories are relative to the Base directory if it doesn't start with a /; e.g. conf/httpd.conf for CentOS's main configuration file translates to /etc/httpd/conf/httpd.conf.
Default Apache configuration value
Apart from using different location for the main configuration file, different distributions also use different options for Apache which could get a bit confusing.
![Apache Web Server Configuration File Apache Web Server Configuration File](/uploads/1/3/4/8/134831166/173433947.png)
The table below lists some of the default configuration values for Apache on different distributions.
Option | Debian, Ubuntu | openSUSE and SLES | Fedora Core, CentOS, RHEL | macOS | homebrew | xampp |
---|---|---|---|---|---|---|
ServerRoot | /etc/apache2/ | n/a | /etc/httpd | /usr/ | /usr/local/opt/httpd/ | {installation directory}/apache/ |
DocumentRoot | /var/www/html/ | /srv/www/ | /var/www/html | /Library/WebServer/Documents/ | /usr/local/var/www/ | {installation directory}/htdocs/ |
Module Location | /usr/lib/apache2/modules/ | /usr/lib64/apache2-prefork/ | modules/ | libexec/apache2/ | lib/httpd/modules/ | modules/ |
Access / Error log | /var/log/apache2 | /var/log/apache2/ | logs/ | /private/var/log/apache2/ | /usr/local/var/log/httpd/ | logs/ |
User | www-data | wwwrun | apache | _www | _www | daemon |
Group | www-data | www | apache | _www | _www | daemon |
Binary name | apache2 | httpd | httpd | httpd | httpd | httpd |
![Apache Web Server Configuration File Apache Web Server Configuration File](/uploads/1/3/4/8/134831166/836486636.png)
Path for files and directories are relative to the Base directory if it doesn't start with a /; e.g. modules/ for CentOS's module directory translates to /etc/httpd/modules/.
Absolute paths which start with / such as Ubuntu's module location are based from the root directory.
Author: Mohd Shakir Zakaria
Cloud architect by profession but always consider himself as a developer, entrepreneur and an opensource enthusiast.
Discuss the article:Cloud architect by profession but always consider himself as a developer, entrepreneur and an opensource enthusiast.
Comment anonymously. Login not required.