Where are the Apache Configuration files on Mac? – httpd.conf

Here’s where to find httpd.conf on Mac. This is the httpd.conf location on Mac OS X 10.6 Snow Leopard and Mac OS X 10.7 Lion. This article also shows how to make the httpd.conf directory visible in the Mac Finder.

What is Httpd.conf?

Httpd.conf is the Apache web server’s main configuration file. Mac OSX ships with Apache installed. See Apache’s configuration docs for how to configure Apache.

Httpd.conf Location on Mac

On Mac httpd.conf location is in the directory /etc/apache2. You can access this folder through the Mac Finder or through the Mac Terminal.

Checked on OS X 10.7, 10.6.8, 10.6.7.

Httpd.conf Location in Mac Finder

You won’t normally see even the /etc/apache2 directory showing up in the Mac Finder. I tried looking in Macintosh HD, but /etc doesn’t show up.)

I found a tip at Codejacked on how to open hidden files in the Finder.

Here’s how to view httpd.conf’s directory in the Mac’s finder:

  1. In the Finder, click the Go menu, and choose Go to Folder…
  2. Type in /etc/apache2.
  3. Click Go.

The Finder will show the apache2 folder, and in it, you’ll see httpd.conf.

Httpd.conf Location in Mac Terminal

You can also get to the httpd.conf file through a terminal session, which is okay if your comfortable in the Unix shell (bash):

tazpro:~ taz$ cd /etc/apache2
tazpro:apache2 taz$ ls
extra		magic		original	users
httpd.conf	mime.types	other

Can’t Save Httpd.conf?

Httpd.conf is protected by OSX from being edited. If you open it with the TextEdit application for example, you won’t be able to save it. For details to bypass this security, see How to Easily Edit Httpd.conf on Mac.

Restart Apache to Apply Configuration Changes

Don’t forget you will need to restart Apache for your configuration changes in httpd.conf to be applied. To restart Apache on Mac:

  1. Go to the Apple menu and choose System Preferences.
  2. Click on Sharing.
  3. Untick Web Sharing.
  4. Tick Web Sharing.
Tagged , , , . Bookmark the permalink.

13 Responses to Where are the Apache Configuration files on Mac? – httpd.conf

  1. Stefano says:

    With Snow Leopard, Apache worked very well. After installing Lion, I can no more start Apache. The check is simply ignored, without error messages. Any idea why? How can I find with Terminal the script to start Apache?

    • I had the same problem. A module was missing (LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so). For checking the configuration, I just use this:
      sudo /usr/sbin/apachectl configtest

      Hope this helps.

    • Tasman Hayes says:

      Mischa – good answer – thanks!

      Stefano, you can start Apache this way from the Terminal this way:

      sudo apachectl start

  2. voigtstr says:

    Is it possible to have Lion serve its default wiki pages _and_ run other sites at the same time.
    I tried editing httpd.conf for virtual hosting and turned on web sharing in preferences, now the default wiki page wont load. The placeholder content for the different sites work, but I wanted http://www.domainname.com or anything not specifically listed in httpd.conf to go to the default wiki/blog site.

  3. Pingback: Setting up Apache, PHP, MySQL, WordPress on Mac OSX Lion - GameDefenderGameDefender

  4. Josue says:

    i need to run perl scripts using apache doesnt work on my mac

  5. Pingback: 맥북 아파치 가상호스트 활성화를 위해선 ‘웹 공유’를 켜야 한다 | 웹으로 말하기

  6. Aminur says:

    Hi,

    I’m looking for the httpd.conf file on my Mac OS X Lion 10.7.5 but no luck. When i go through the directory and come to all these other files ie httpd-vhosts.conf but not the actual configuartion file. I tried it on the terminal with the following command : sudo vi /etc/apache2/httpd.conf but it asks for my password. I assumed its the same password for when I log in but no joy. Can you help me please? I am really stuck.

  7. exoboy says:

    Thanks for the tip on the folder being hidden! ALL the articles I have found on enabling PHP on my mac seem to neglect this little, critical fact.

  8. Pingback: Bit-taming » PHP Basic Authentication template

  9. Arpit says:

    To restart the apache in mac run the command :
    sudo apachectl restart

  10. Hi,

    Yes thanks so much about those details on finding the hidden files. That’s all the difference. Also a couple things I learned. Check the console for error messages from apache.

    Also $ sudo apachectl -t

    and it gave me the answer, some misskey made the apache conf invalid, I fixed the errors and that’s it, now it’s working fine

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>