RedHat iTOps Tube

Thursday, November 17, 2011

The conf.d Directory

The conf.d Directory

Files in the /etc/httpd/conf.d (Redhat / Fedora) or the /etc/apache*/conf.d (Debian / Ubuntu) directory are read and automatically appended to the configuration in the httpd.conf file every time Apache is restarted. In complicated configurations, in which a Web server has to host many Web sites, you can create one configuration file per Web site each with its own set of <VirtualHost> and <Directory> containers. This can make Web site management much simpler. To do this correctly:


  1. Backup your httpd.conf file, in case you make a mistake.
  2. Create the files located in this directory that contain the Apache required <VirtualHost> and <Directory> containers and directives.
  3. If each site has a dedicated IP address, then place the NameVirtualHost statements in the corresponding conf.d directory file. If it is shared, it'll need to remain in the main httpd.conf file.
  4. Remove the corresponding directives from the httpd.conf file.
  5. Restart Apache, and test.

The files located in the conf.d directory don't have to have any special names, and you don't have to refer to them in the httpd.conf file.