MacOS – the apache config files stored

apachemacos

I thought the apache config files were stored in /etc/apache2. Yet if I remove the /etc/apache2 directory and run a sudo /usr/sbin/apachectl start the web server runs and serves up pages.

Is there another set of config files?

Best Answer

At least on my system (OS X 10.9.2), I see that apache is going to use /private/etc/apache2. Note SERVER_CONFIG_FILE below:

$ sudo /usr/sbin/apachectl -V
Server version: Apache/2.2.26 (Unix)
Server built:   Dec 10 2013 22:09:38
Server's Module Magic Number: 20051115:33
Server loaded:  APR 1.4.5, APR-Util 1.3.12
Compiled using: APR 1.4.5, APR-Util 1.3.12
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_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_FLOCK_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -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"

Normally /etc is a symlink to /private/etc, but if it isn't on your system, that may explain the discrepancy.