I'm trying to set up virtual hosts on Mac OS X. I've been modifying httpd.conf and restarting the server, but haven't had any luck in getting it to work. Furthermore, I notice that it's not serving files in the DocumentRoot mentioned in httpd.conf (Libraries/WebServer/Documents), but in a different directory (/usr/local/apache2/htdocs). I don't see this folder mentioned anywhere in httpd.conf. Furthermore, PHP works, but the "LoadModule php5_module" line is commented out. This makes me think it's using another .conf file. How can I figure out which config is actually being loaded?

Update: I just deleted that httpd.conf and apache behaves the same after restart, so it definitely wasn't using it!

5 Answers 5


With any *nix application, the easiest method is to query the binary itself. In the case of httpd, I'd imagine the process would be something like this:

$ whereis httpd
$ /usr/sbin/httpd -V
Server version: Apache/2.2.11 (Unix)
Server built:   Jun 17 2009 14:55:13
Server's Module Magic Number: 20051115:21
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/bin/suexec"
 -D DEFAULT_PIDLOG="/private/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/private/var/run/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"

As you can see - my OS X says the binary, if not directed otherwise, will use the config file: /private/etc/apache2/httpd.conf

If that doesn't help, perhaps Christopher's suggestion of find is the next step.

  • 2
    This won't work if you're using Apache via the Server.app In that case you'll need the process list in the answer from @msanford serverfault.com/a/155114/187798 which shows that the Server.app starts httpd with a different configuration file as shown here from my installation (Mavericks) /usr/sbin/httpd -D FOREGROUND -f /Library/Server/Web/Config/apache2/httpd_server_app.conf -D WEBSERVICE_ON
    – Jason S
    Commented Dec 1, 2013 at 3:16
  • also does not work with when using apache installed via macports -- answer by msandord works for me!
    – pgee70
    Commented Jun 17, 2014 at 9:53

There's another serverfault question regarding this. If you're using a debian based server you can use apache2ctl to determine which config file is being used:

apache2ctl -V

More on this:

How to find out which httpd.conf apache is using at runtime

  • On macOS, the command to find out which config files the running instance of https is actually using is apachectl -t -D DUMP_INCLUDES. Commented Apr 6, 2022 at 12:03


ps ax | grep httpd

and you should (might) get output like

1633   ??  Ss     0:00.21 /usr/sbin/httpd -f /etc/httpd.conf

Additionally, how exactly are you restarting the server? Just curious in case you somehow aren't actually re-reading the config file.

  • hm it doesn't have the -f flag in it
    – Claudiu
    Commented Jun 26, 2010 at 15:50
  • 1
    +1 As this is the only answer that works for all cases, that is if you're configuring Apache yourself or if you're using Apache via Server.app
    – Jason S
    Commented Dec 1, 2013 at 3:17
  • It doesn't work for me, may due to my current error conf.... Commented Jul 9, 2021 at 9:51

Because some configs use Server app, brew or whatever, and because one liners FTW :

$(ps ax -o comm | grep -m 1 httpd) -V | grep SERVER_CONFIG_FILE

This command do the following :

  • Find an active httpd process
  • Output config info
  • Grep the config file

Tested on Sierra & El Capitan

  • 1
    The $ is important (it's not the command line prompt in this case). If converts the statement in parens into a command, to which we pass the -V flag. Leaving it out results in: "syntax error near unexpected token `-V'".
    – Tom Auger
    Commented Nov 7, 2019 at 19:35

First, check which is the startup script for Apache. For macOS, it should be /Library/LaunchDaemons. That might include a working directory, or similar information.

You could also debug the running process itself with dtruss. You can connect to the running process using dtruss -p <pid>. Then, if you HUP it, you can probably pore over the output to see where it's grabbing its config from. Alternately, just start Apache by calling dtruss directly with dtruss start_apache_command.

You could always just do a system-wide search for httpd.conf with find / -name httpd.conf.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .