Search code examples
macosapacheosx-elcapitan

El Capitan upgrade and Apache VHost problems


So this caught me out. I've figured to diff between /etc/httpd.conf and /etc/httpd.conf.pre-update and correct default LoadModules and Includes which the upgrade applied, but I have a number of vhosts which are not playing nicely. All were fine prior to upgrade and are failing along the lines of:

http://localhost (DocumentRoot /www works fine)
http://test (DocumentRoot /www/test serves "It works!" from the standard DocumentRoot and nothing shows in /var/log/apache2/access_log)
http://test/index.php (works)
http://localhost/test (works)

httpd.conf extract

DocumentRoot "/www"
<Directory "/www">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

httpd-vhosts.conf extract

<VirtualHost *:80>
    DocumentRoot "/www/test"
    ServerName test
</VirtualHost>

The ServerName is set in /etc/hosts and pings correctly, and it works when explicitly specifying the file so this looks good. Also tried with test.local (and test as ServerAlias) which made no difference.

DirectoryIndex has been set as "index.php index.html" which made no difference, and as http://localhost/test" correctly serves index.php, that looks as it should be.

And when http://test is accessed, it returns the standard "It works!" file from /Library/WebServer/Documents/index.html.en. This directory is only referenced from /etc/apache2/original/httpd.conf and /etc/apache2/extra/httpd-ssl.conf.

httpd -V shows correct conf is in use

Server version: Apache/2.4.16 (Unix)
Server built:   Aug 22 2015 16:51:57
Server's Module Magic Number: 20120211:47
Server loaded:  APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -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=256
 -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_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"

httpd -S shows sites are loading correctly

VirtualHost configuration:
*:80                   is a NameVirtualHost
     default server localhost (/private/etc/apache2/extra/httpd-vhosts.conf:24)
     port 80 namevhost localhost (/private/etc/apache2/extra/httpd-vhosts.conf:24)
     port 80 namevhost phpmyadmin (/private/etc/apache2/extra/httpd-vhosts.conf:29)
     port 80 namevhost site1.local (/private/etc/apache2/extra/httpd-vhosts.conf:34)
     port 80 namevhost ideas.local (/private/etc/apache2/extra/httpd-vhosts.conf:39)
     port 80 namevhost site2.local (/private/etc/apache2/extra/httpd-vhosts.conf:44)
     port 80 namevhost site3.local (/private/etc/apache2/extra/httpd-vhosts.conf:49)
     port 80 namevhost site4 (/private/etc/apache2/extra/httpd-vhosts.conf:54)
     port 80 namevhost site5 (/private/etc/apache2/extra/httpd-vhosts.conf:59)
     port 80 namevhost site6 (/private/etc/apache2/extra/httpd-vhosts.conf:64)
     port 80 namevhost site7 (/private/etc/apache2/extra/httpd-vhosts.conf:69)
     port 80 namevhost site8 (/private/etc/apache2/extra/httpd-vhosts.conf:74)
     port 80 namevhost test (/private/etc/apache2/extra/httpd-vhosts.conf:79)
ServerRoot: "/usr"
Main DocumentRoot: "/www"
Main ErrorLog: "/private/var/log/apache2/error_log"
Mutex default: dir="/private/var/run/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex proxy: using_defaults
PidFile: "/private/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="_www" id=70 not_used
Group: name="_www" id=70 not_used

The *.local sites load correctly, though their DocumentRoots are like:

/www/site1/public

I've been looking at it so long, I'm missing something really obvious aren't I. Put me out of my misery please.

Thanks.


Solution

  • So, end result appears to be that either I'm very, very stupid, or Safari's caching system is very, very stupid.

    I'll get my coat...

    (I remain shocked by how badly El Capitan has messed up my system - I clearly still have much to learn about OSX)