Mac OS X 10.6.3: how does Apache config work?

7,719

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.

Share:
7,719

Related videos on Youtube

nunoaomaia
Author by

nunoaomaia

Updated on September 17, 2022

Comments

  • nunoaomaia
    nunoaomaia over 1 year

    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.

  • nunoaomaia
    nunoaomaia about 14 years
    hey marnix, thanks for replying. couple things: - how would i know that /etc/apache2/httpd.conf is a symlink? when i do ls -al in /etc/apache2 it shows up as a normal file? same thing for the one in private. - if macports installed apache2, how do i remove it? - is it normal for macports to install apache2 to /opt/local/ even tho there is an apache2 on my system already? thanks
  • Hasaan Chop
    Hasaan Chop about 14 years
    The entire /etc directory is a symlink.
  • Marnix A.  van Ammers
    Marnix A. van Ammers about 14 years
    I should have stated that /etc is a symbolic link to /private/etc .
  • Marnix A.  van Ammers
    Marnix A. van Ammers about 14 years
    I'm not sure what the proper procedure is to remove macports files. I do believe it is normal for macports to go into /opt/local .
  • nunoaomaia
    nunoaomaia about 14 years
    see above update pls. Marnix's answer does answer my original questions (and replies in comments were also helpful) so i've marked it as accepted answer. Thx.