Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am configuring apache and by default I have the directories /etc/httpd/conf and /etc/httpd/conf.d. What is the difference?

Also you can see the suffix in many other directories like /etc/init.d, /etc/cron.d etc...

share|improve this question
1  
it means it's referring to a daemon –  dynamic Feb 25 '11 at 11:37
    
dupe: askubuntu.com/questions/7648/… –  Sirex Feb 25 '11 at 12:03
4  
@yes123: That theory doesn't fit well with /etc/apt/sources.list.d/, /etc/profile.d etc –  Martin Feb 25 '11 at 12:04
    
From the answers given by Haakon and deltaray, I wonder if .d stands for default. It doesn't, according to the information here, but it seems logical. Perhaps I can go ahead and think of it that way? –  Smandoli Nov 1 '12 at 19:21
add comment

migrated from stackoverflow.com Feb 25 '11 at 11:28

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 25 down vote accepted

"d" stands for directory and such a directory is a collection of configuration files which are often fragments that are included in the main configuration file. The point is to compartmentalize configuration concerns to increase maintainability.

When you have a distinction such as /etc/httpd/conf vs /etc/httpd/conf.d, it is usually the case that /etc/httpd/conf contains various different kinds of configuration files, while a .d directory contains multiple instances of the same configuration file type (such as "modules to load", "sites to enable" etc), and the administrator can add and remove as needed.

share|improve this answer
1  
but conf is also a directory, so if both are directories, what is the difference? You are right about ServerFault, is it possible to move it? –  SCL Feb 25 '11 at 9:36
    
Added a bit about the distinction, hope it is not entirely confusing :-) –  Haakon Feb 25 '11 at 10:10
5  
The .d directories are also normally auto loaded. For example, cron will check cron.d and parse any files within there, the main apache config will have something like "include conf.d/*" which will include any files within conf.d on reload. It's also really handy for package management of modules. The package manager doesn't have to attempt to edit files, it just drops the config for the module into the correct .d directory, and then reloads the service. –  Niall Donegan Feb 25 '11 at 11:45
add comment

The main driving force behind the existence of this directory naming convention is for easier package management of configuration files. Whether its rpm, deb or whatever, it is much easier (and probably safer) to be able to drop a file into a directory so that it is auto included into a program's configuration instead of trying to edit a global config file.

A good example of this is logrotate. In the directory /etc/logrotate.d are config files for practically every application you have installed that keeps a log in /var/log. Some are bunched into the syslog config because nearly every system has a messages, wtmp and lastlog file. But if you install Apache on your system, you need an easy way of automatically adding the config for rotating Apache's logs, so it just drops a config file called httpd in /etc/logrotate.d and logrotate is configured to include the files in that directory. Each one is owned by the package for the daemon and if you remove the package it will remove the file. Its basically a way of modularizing config files. Note that this needs to be supported by the program, its not something automatic that the system does for you or something. Usually programs that do it have a config directive called include that specify where that directory is located on the filesystem.

logrotate.d might even be the first place this convention was used outside of the init.d and rc.d directories for init scripts.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.