Apache configuration on OS X Yosemite

1.3k Views Asked by At

After upgrading to Yosemite, my Apache configuration seems broken. My main problem is that the Document Root is changed. Now all I get is a "It works!" page.

I can't figure out why, everything looks fine to me.

I have set up properly /etc/apache2/httpd.conf and DocumentRoot is in fact /Library/WebServer/Documents as it was before... Also /private/etc/apache2/httpd.conf contains the same... Moreover, the additional configuration to have a directory for the user (e.g. localhost/~user1) is not loaded.

I don't know what to do.

Can somebody help me please?

Thanks.

1

There are 1 best solutions below

2
On

I had the same problem. Apparently the document root changed to /usr/local/var/apache2/htdocs . I found this by checking what config file was being loaded by apache.

sudo apachectl -V

You should see something like this

 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_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=256
 -D HTTPD_ROOT="/usr/local/Cellar/apache24/2.4.10"
 -D SUEXEC_BIN="/usr/local/Cellar/apache24/2.4.10/bin/suexec"
 -D DEFAULT_PIDLOG="/usr/local/var/run/apache2/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/usr/local/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/usr/local/etc/apache2/httpd.conf"

At the very end shows that is no longer loading the /private/etc/apache2/httpd.conf but instead is loading it from /usr/local/etc/apache2/httpd.conf

An easy workaround would be to move all your /Library/Webserver/Documents to the new DocumentRoot location /usr/local/etc/apache2/htdocs

Or just pass the old httpd.conf file to apachectl by doing

sudo apachectl -f /private/etc/apache2/httpd.conf