Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an apache configuration file which works fine when it's placed directly in /etc/httpd/conf.d/foo.conf. However, when I move the same file somewhere else (for example, move it to /tmp/foo.conf) and then create a symlink with ln -s /tmp/foo.conf /etc/httpd/conf.d then apache fails on startup with:

httpd: could not open document config file /etc/httpd/conf.d/foo.conf

I've tried making the file and the symlink mode 777, and tried changing them to be owned by the apache user.

It seems like apache is failing to load the file purely on the basis of it being a symlink, but I'm sure I've used symlinks successfully on other machines. Is there something I'm missing? Does apache have an option for refusing to load config files if they're symlinks?

The operating system is CentOS 4.4, apache version 2.0.52.

share|improve this question
Interesting to note that if you search for "symlink httpd config OR conf.d" without quotes on google, this is already the number one result. – Kevin M Apr 23 '10 at 16:28
up vote 4 down vote accepted

Is SELinux enabled on this server? I wonder if this is stopping apache from loading this symlink correctly?

share|improve this answer
Precisely the thought I had, but note that it worked when the file was in the conf.d directory, but not when it's outside the directory with a symlink to it. – Kevin M Apr 23 '10 at 15:51
Disabling selinux fixed it -- thank you! – kdt Apr 23 '10 at 17:03
@kdt Disabling selinux is an easy fix but far from a good fix. SElinux can be rather daunting, but there are some great guides and tutorials on how to use it correctly! Here's a very well done talk that is easy enough to follow: – TheGrandPackard Nov 20 '15 at 21:06

The permissions for the apache user shouldn't matter as in general apache is run starting as root and then in launches webserver as the apache user (or whatever the user directive is). I believe this would have to be after the config file is loaded.

Can you cat the symlink?

share|improve this answer

Instead of creating a symlink from conf.d to wherever it is, could you leave the file in the conf.d directory and create a symlink to the file in conf.d. Example syntax: ln -s /etc/httpd/conf.d/foo.conf /tmp/foo.conf

Alternatively, use a hard link, so it is a regular file in both places. One file with two locations. Example syntax: ln /tmp/foo.conf /etc/httpd/conf.d Note that this will only work if both locations are on the same filesystem.

share|improve this answer

Your Answer


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.