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

Skip to the content

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.

- Tags
  Apache, httpd.conf, Mac, Mac OS X 10.7 Lion

## 13 replies on “Where are the Apache Configuration files on Mac? – httpd.conf”

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.

Mischa – good answer – thanks!

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

`sudo apachectl start`

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.

[…] For those not in the know, it’s at /etc/apache2 […]

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

[…] 결국, Where are the Apache Configuration files on Mac? – httpd.conf 에서 실마리를 찾을 수 있었는데, ‘시스템 환경설정’에 들어가서 ‘공유 > 웹 공유’를 활성화해야 하는 것이었다. 아래 그림을 참고하면 된다. […]

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.

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.

You’re welcome Exoboy! 🙂

[…] Development server setup (for Mac OSX 10.6.8 snow leopard). I found the following links to be very useful (although I cannot vouch they will apply to your setup!). Enable apache on OSX. More info here. […]

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

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

Comments are closed.