Macos – Mac OS X 10.6.3: how does Apache config work

apache-http-servermacosmacports

Just got a MacBook Pro 15" so I'm unfamiliar with how the filesystem is laid out. I noticed when in my filesystem that I've got a few paths specifying httpd.conf:

/etc/apache2/httpd.conf
/opt/local/apache2/conf/httpd.conf
/private/etc/apache2/httpd.conf

The config files are different in lots of ways (user, group, server_root, modules that are loaded, etc.) The apache2 folders themselves also greatly differ.

It seems that the one getting used is either /etc/apache2/httpd.conf or /private/etc/apache2/httpd.conf

I'm wondering if I might have messed up my system after installing some packages (php5, django, etc) via macports and maybe ended up with 2 apache2 instances.

My questions are hence:

  • which httpd.conf is the one being used ?
  • what are the other files for?

thanks

–update–
To clarify, I didn't explicitly install apache2 via macports. I'm wondering if it was installed because it was a dependency.
After more hunting around I'm learning I never should've installed php to begin with because Snow Leopard already includes php 5.3 from the get go.
https://serverfault.com/questions/82410/apache-2-and-php-5-3-via-macports

I'll need to open another question that asks about how the Mac filesystem works.
Thanks all for replies.

Best Answer

The /etc/apache2/httpd.conf file is just a symbolic link pointing to the /private/etc/apache2/httpd.conf file (so their contents should be identical).

The one in /opt/local/apache2 was probably loaded by you when you installed macports.

One relatively easy way to see which one is being used is to check the last access times of the files:

ls -lutrd /opt/local/apache2/conf/httpd.conf /private/etc/apache2/httpd.conf

Check the time stamps to see which one was last used. If you have opened/looked-at the files, then that could change the date, so in that case you could reboot your machine and then check the access date/times of those files.