I am using Apache2 with UBUNTU14 LTS, all "standard" server.
The problem is simple, when using http://www.example.com it works fine, but when using http://example.com it doesn't, it goes to the wrong index.
Describing details
I have folders at ls /var/www/
example.com example2.example html
wiki.example.com wp.example2.example
Each with different and good index.htm working with http://www.example.com (goes to /var/www/example.com) or http://wiki.example.com, etc. But the index of http://example.com goes to /var/www/html/index.htm, not to /var/www/example.com (!).
At /etc/apache2/sites-available/example.com.conf we have,
<VirtualHost *:80>
ServerAdmin mymail#ggmail.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName wiki.example.com
DocumentRoot /var/www/wiki.example.com
</VirtualHost>
EDIT (notes)
We are using a workaround — and please ignore the "real world" examples in the comments, it is not valid as real testing —, an ugly piece of PHP code (not a solution) in the /var/www/html/index.php of the root (no subdomain), to redirect to www subdomain,
if ( preg_match( // if HTTP from other domain, redirects
'/(mydomain1|mydomain2|mydomain3)/',
strtolower($_SERVER['HTTP_HOST']),
$m
) ) switch($m[1]) {
case 'mydomain1':
header("Location: https://www.example.com"); die('');
case 'mydomain2':
header("Location: https://www.example2.example"); die('');
case '...':
header("Location: https://www...."); die('');
}
EDIT
As #covener comment suggest, apachectl -S, results in
VirtualHost configuration:
*:80 is a NameVirtualHost
default server localhost (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost atarica.com.br (/etc/apache2/sites-enabled/atarica.com.br.conf:1)
alias www.atarica.com.br
port 80 namevhost wiki.atarica.com.br (/etc/apache2/sites-enabled/atarica.com.br.conf:13)
port 80 namevhost atarica.com.br (/etc/apache2/sites-enabled/fabrincantes.com.conf:1)
alias www.fabrincantes.com
port 80 namevhost yellowtown.org (/etc/apache2/sites-enabled/yellowtown.org.conf:1)
alias www.yellowtown.org
port 80 namevhost wiki.yellowtown.org (/etc/apache2/sites-enabled/yellowtown.org.conf:35)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used
Try this:
<VirtualHost *:80>
ServerName example.com
Redirect permanent / http://www.example.com/
</VirtualHost>
Then you just need to create another section with ServerName www.example.com for your real server configuration.
Also, wouldn't CNAME's records work has an alternative to this? (I'm not sure)
Sorry all, that was my "human error", as blind spot when reading file.conf scripts, and a general blindness here after my edit showing apachectl -S results, the error is there (! see fabrincantes.com lines), a wrong name "AAA" on the "BBB" configuration:
port 80 namevhost AAA (/etc/apache2/sites-enabled/BBB.conf:1)
alias BBB
so I fixed with simple name correction on my BBB.conf, that has an ServerName AAA instead "BBB",
<VirtualHost *:80>
...
ServerName BBB
...
</VirtualHost>
You would require to edit your /etc/hosts file so it points to correct links.
For example, configuration on my localhost would be
127.0.1.1 example.com www.example.com
Related
I have Apache Lounge httpd-2.4.54-win64-VS17.zip installed on Windows 11.
I am following instructions at [1] to set up 2 vhosts. The vhosts are defined as:
# Ensure that Apache listens on port 80
#Listen *:80
<VirtualHost 192.168.0.1:80>
#/www/example1 directory is ralative to ${ServerRoot} which is "c:/apache24"
DocumentRoot "C:/Apache24/www/bletch"
ServerName bletch.net
ServerAlias www.bletch.net
</VirtualHost>
<VirtualHost 192.168.0.1:80>
DocumentRoot "C:/Apache24/www/dorfy"
ServerName dorfy.org
ServerAlias www.dorfy.org
</VirtualHost>
In httpd.conf, the Include conf/extra/httpd-vhosts.conf is uncommented.
The contents of /etc/hosts is:
127.0.0.0 localhost
::0 localhost
192.168.0.1 bletch.net
::1 bletch.net
192.168.0.1 dorfy.org
::1 dorfy.org
My httpd.conf contains the following:
Define SRVROOT "C:/Apache24"
ServerRoot "${SRVROOT}"
Listen 80
DocumentRoot "${SRVROOT}/htdocs"
<Directory "${SRVROOT}/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Include conf/extra/httpd-vhosts.conf
I have a unique index.html file in the htdocs, bletch, and dorfy directories so I will know exactly which one, if any, is being displayed in browser when requested. And I am using two browsers for testing, google chrome and ms edge.
I have cleared browser cache, set browswer to recognize and use /etc/hosts for local DNS lookup, and have run ipconfig /flushdns, and restarted httpd.
I have executed httpd -t -D DUMP_VHOSTS -D DUMP_RUN_CFG and got the following report:
C:\Apache24\bin>httpd -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
VirtualHost configuration:
192.168.0.1:80 is a NameVirtualHost
default server bletch.net (C:/Apache24/conf/extra/httpd-vhosts.conf:44)
port 80 namevhost bletch.net (C:/Apache24/conf/extra/httpd-vhosts.conf:44)
alias www.bletch.net
port 80 namevhost dorfy.org (C:/Apache24/conf/extra/httpd-vhosts.conf:51)
alias www.dorfy.org
ServerRoot: "C:/Apache24"
Main DocumentRoot: "C:/Apache24/htdocs"
Main ErrorLog: "C:/Apache24/logs/error.log"
Mutex default: dir="C:/Apache24/logs/" mechanism=default
PidFile: "C:/Apache24/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: SRVROOT=C:/Apache24
THE PROBLEM IS:
Request for localhost works correctly in both browers.
Request for www.bletch.net and www.dorfy.org in both browsers reslults in site can't be reached.
Request for bletch.net and dorfy.org both result in display of locoalhost index.html.
I have reviewed multiple posts on StackOverFlow, and Apache users list archive and found solutions to various problems (such as the need to set browsers to use /etc/hosts DNS lookup file and other mistakes I made) but have not found what is needed at the current state explained here.
Please, can anyone tell me what how to fix this? Thanks.
[1] [Troubleshooting Vhosts][1]
I'm having an issues trying to resolve a third virtual host. The third virtual host always resolves to index of/.
Localhost and eshop.lh both correctly resolve their own individual index files.
UPDATE 1 I've added another test vHost, this also does not resolve correctly and serves index of/. Removing eshop and localhost does not change this behaviour.
UPDATE 2
Changed loglevel config to debug.
The errors i'm getting is no matching ServerName but it seems to be looking in SSL 433 VHost configurations. The names and paths are correct, no typos.
[ssl:debug] [pid 14388:tid 1924] ssl_engine_kernel.c(2364): [client 127.0.0.1:54023] AH02044: No matching SSL virtual host for servername engine.lh found (using default/first virtual host)
It then defaults the connection to (server www.example.com:443) which is the first configures (default) SSL VHost in the httpd-ssl.conf file.
As a test, i spoofed the ServerName for eshop.lh to see if it would also serve me the SSL Vhost default, but it doesn't. It serves me localhost which is the first Vhost configuration for port 80.
Vhost configuration: Showing spoofed eshop.lh and including 433 config too, that i left out previously.
VirtualHost configuration:
*:80 is a NameVirtualHost
default server localhost (C:/xampp/apache/conf/extra/httpd-vhosts.conf:46)
port 80 namevhost localhost (C:/xampp/apache/conf/extra/httpd-vhosts.conf:46)
port 80 namevhost engine.lh (C:/xampp/apache/conf/extra/httpd-vhosts.conf:53)
port 80 namevhost test.lh (C:/xampp/apache/conf/extra/httpd-vhosts.conf:60)
port 80 namevhost eshot.lh (C:/xampp/apache/conf/extra/httpd-vhosts.conf:67)
*:443 www.example.com (C:/xampp/apache/conf/extra/httpd-ssl.conf:121)
UPDATE 3
Re-installed xampp and it appears to be working smoothly now.
My configuration:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/localhost"
ServerName localhost
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/eshop.lh/"
ServerName eshop.lh
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/engine.lh/"
ServerName engine.lh
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
</VirtualHost>
127.0.0.1 localhost
::1 localhost
127.0.0.1 eshop.lh
127.0.0.1 engine.lh
The paths are correct on my machine.
It's engine.lh that won't resolve correctly. eshop.lh works fine.
The file inside the engine.lh directory are simply:
read.me
index.html
Calling httpd -t -D DUMP_VHOSTS produces:
*:80 is a NameVirtualHost
default server localhost (C:/xampp/apache/conf/extra/httpd-vhosts.conf:44)
port 80 namevhost localhost (C:/xampp/apache/conf/extra/httpd-vhosts.conf:44)
port 80 namevhost eshop.lh (C:/xampp/apache/conf/extra/httpd-vhosts.conf:52)
port 80 namevhost engine.lh (C:/xampp/apache/conf/extra/httpd-vhosts.conf:60)
I restart apache with: hpptd -k restart or via the control panel.
In the apache docs: Name-based Virtual Host support, it gives this example to serve up different vhosts:
<VirtualHost *:80>
# This first-listed virtual host is also the default for *:80
ServerName www.example.com
ServerAlias example.com
DocumentRoot "/www/domain"
</VirtualHost>
<VirtualHost *:80>
ServerName other.example.com
DocumentRoot "/www/otherdomain"
</VirtualHost>
I'm using Ubuntu 16.0.4, and have vhost configured, with all .conf files located at /etc/apache2/sites-available and all enabled sites at /etc/apache2/sites-enabled using a2ensite for each site conf. I have 000-default.conf disabled, and I'm using certbot, along with the latest of apache and PHP 7.2.x.
Two of my sites have an issue with the vhost configuration. The sites are:
Site 1: clients.site1.com.conf
Site 2: clients.site2.com.conf
Site 3: site3.com.conf (Mention later)
If I go to clients.site1.com in the browser, it loads fine.
If I go to clients.site2.com in the browser, the url shows clients.site2.com loaded, but it is actually loading clients.site1.com content from /var/www/clients.site1.com/public_html.
I've checked clients.site1.com.conf, and have the following:
<VirtualHost *:80>
ServerAdmin webmaster#clients.site1.com
ServerName clients.site1.com
ServerAlias clients.site1.com
DocumentRoot /var/www/clients.site1.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =clients.site1.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
I've checked clients.site2.com.conf, and have the following:
<VirtualHost *:80>
ServerAdmin webmaster#clients.site2.com
ServerName clients.site2.com
ServerAlias clients.site2.com
DocumentRoot /var/www/clients.site2.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =clients.site2.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
I have played around with the file name of the conf files thinking that having two conf files with clients. had an issue with the wildcard matching. So I tried removing the dot ., and even tried replacing it with a hyphen -. Still the same result.
The last test I did was I disabled clients.site1.com.conf. When I did that and then proceeded with loading clients.site2.com in my browser, the next site in order of the conf files (Site 3 above to serve as an example) is what loads.
UPDATE:
I ran apache2ctl -S and got the following:
root#ip-111-111-111-111:/etc/apache2/sites-available# apache2ctl -S
VirtualHost configuration:
*:443 is a NameVirtualHost
default server clients.site1.com (/etc/apache2/sites-enabled/clients.site1.com-le-ssl.conf:2)
port 443 namevhost clients.site1.com (/etc/apache2/sites-enabled/clients.site1.com-le-ssl.conf:2)
alias clients.site1.com
port 443 namevhost site3.com (/etc/apache2/sites-enabled/site3.com-le-ssl.conf:2)
alias www.site3.com
port 443 namevhost aaaaa.com (/etc/apache2/sites-enabled/aaaaa.com-le-ssl.conf:2)
alias www.aaaaa.com
port 443 namevhost bbbbb.com (/etc/apache2/sites-enabled/bbbbb.com-le-ssl.conf:2)
alias www.bbbbb.com
port 443 namevhost ccccc.com (/etc/apache2/sites-enabled/ccccc.com-le-ssl.conf:2)
alias www.ccccc.com
port 443 namevhost ddddd.com (/etc/apache2/sites-enabled/ddddd.com-le-ssl.conf:2)
alias www.ddddd.com
port 443 namevhost eeeee.com (/etc/apache2/sites-enabled/eeeee.com-le-ssl.conf:2)
alias www.eeeee.com
port 443 namevhost ip-111-111-111-111.ec2.internal (/etc/apache2/sites-enabled/fffff.com-le-ssl.conf:2)
alias www.fffff.com
port 443 namevhost ggggg.com (/etc/apache2/sites-enabled/ggggg.com-le-ssl.conf:2)
alias www.ggggg.com
port 443 namevhost site2.com (/etc/apache2/sites-enabled/site2.com-le-ssl.conf:2)
alias www.site2.com
*:80 is a NameVirtualHost
default server ip-111-111-111-111.ec2.internal (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost ip-111-111-111-111.ec2.internal (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost clients.site1.com (/etc/apache2/sites-enabled/clients.site1.com.conf:1)
alias clients.site1.com
port 80 namevhost clients.site2.com (/etc/apache2/sites-enabled/clients.site2.com.conf:1)
alias clients.site2.com
port 80 namevhost site3.com (/etc/apache2/sites-enabled/site3.com.conf:1)
alias www.site3.com
port 80 namevhost aaaaa.com (/etc/apache2/sites-enabled/aaaaa.com.conf:1)
alias www.aaaaa.com
port 80 namevhost bbbbb.com (/etc/apache2/sites-enabled/bbbbb.com.conf:1)
alias www.bbbbb.com
port 80 namevhost ccccc.com (/etc/apache2/sites-enabled/ccccc.com.conf:1)
alias www.ccccc.com
port 80 namevhost ddddd.com (/etc/apache2/sites-enabled/ddddd.com.conf:1)
alias www.ddddd.com
port 80 namevhost eeeee.com (/etc/apache2/sites-enabled/eeeee.com.conf:1)
alias www.eeeee.com
port 80 namevhost ip-111-111-111-111.ec2.internal (/etc/apache2/sites-enabled/fffff.com.conf:1)
alias www.fffff.com
port 80 namevhost ggggg.com (/etc/apache2/sites-enabled/ggggg.com.conf:1)
alias www.ggggg.com
port 80 namevhost site2.com (/etc/apache2/sites-enabled/site2.com.conf:1)
alias www.site2.com
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
root#ip-111-111-111-111:/etc/apache2/sites-available#
There are a couple of things you can do to help with debugging:
apache2ctl -S
This will show you the vhost configuration that Apache believes you have. it is important to a2dissite a configuration file before renaming it, etc.
I have 000-default.conf disabled
You are better off keeping this enabled and creating a default file that is loaded when Apache doesn't know where to go. It can be a very simple file that just says "error", but then you will be aware when Apache believes it has nowhere to go. Plus it is better security to have a honey pot for all requests coming in that aren't legitimate. Lastly, I have this vague memory of discovering that it might actually pick one of the vhosts randomly if the 000-default is not set, but not sure, but it would explain the site 3 behavior.
Lastly, you have both ServerName and ServerAlias set to the same URL. This is not necessary and while I don't think it is the problem, better to take it out of the mix.
Otherwise I do not see any problems with your vhosts files and should work.
Update
You are redirecting to the https URL. So what is dictating Apache is the -le-ssl.com.conf file. I have similarly fought this with Let's Encrypt. Here are my procedures for making both Apache and Let's Encrypt happy:
create the one configuration (website.com.conf) for the non-secure port 80
a2ensite website.com.conf
apache2ctl graceful (so Apache knows of the non-secure URL)
letsencrypt --apache -d website.com (this will generate the entire -le-ssl file)
apache2ctl graceful
In case it can help somebody : I had the exact same problem.
Several websites configured in Apache. They were working correctly.
I moved them to a new server. I don't know why (maybe a difference in the default Apache conf) but they started to behave like explained in the question, like "pointing" to a default site.
The reason was that I didn't have a ServerAlias line forwarding the "non www" name of the site to the "www prefixed" name.
I was used to typing "mydomainname.com" instead of "www.mydomainname.com" because I have a line in my DNS config that forwards the requests to www.xxxx if www is missing.
So, Apache was not finding the ServerName, and trying to pass the request to the default site.
But, because I has deleted the content of the 000-default.conf file, the request was passed to the first working website.
So make sure you have :
A working 000-default.conf file
A ServerAlias for your www prefixed site like
ServerAlias www.yourdomainname.com
I've been trying to get my head around this all night with no success no matter how many tutorials and resources I've looked through.
My aim is to be able to go to two different websites on the one running apache server.
End goal is something like this(using local ip);
192.168.1.8/site1 -> first site
192.168.1.8/site2 -> second site
I have included the following in my httpd.conf
<VirtualHost *:80>
DocumentRoot "/root/sites/site1"
ServerName site1
</VirtualHost>
<VirtualHost *:80>
ServerName site2
DocumentRoot "/root/sites/site2"
</VirtualHost>
Its worth mentioning that the default DocumentRoot and Directory settings are still in the http.conf and actually point to the site1 files.
Going to 192.168.1.8 takes me to site1 (guessing from the DocumentRoot settings in the http.conf)
Going to /site1 or /site2 both give me a 404 Not Found
I've run -S to see any problems but it looks good as far as I can tell;
VirtualHost configuration:
*:80 is a NameVirtualHost
default server site1 (/usr/local/etc/apache24/httpd.conf:244)
port 80 namevhost site1 (/usr/local/etc/apache24/httpd.conf:244)
port 80 namevhost site2 (/usr/local/etc/apache24/httpd.conf:248)
ServerRoot: "/usr/local"
Main DocumentRoot: "/usr/local/www/apache24/data"
Main ErrorLog: "/var/log/httpd-error.log"
Mutex default: dir="/var/run/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www" id=80
Group: name="www" id=80
Can anyone spot anything obvious that I have missed?
NameVirtualHosts are intended to be accessed by name, not by IP address. With your configuration, you've told Apache to listen for incoming connections to the hostnames "site1.example.com" and "site2.example.com" (substitute your own domain for "example.com")
Without a name to distinguish them, you can't have two virtual hosts listening to the same IP address and same port. When you go to http://192.168.1.8 , Apache has no way of knowing whether you're intending to reach site1 or site2. So it sends you to the first host that matches, which is the first <VirtualHost *:80> in your configuration. Then it takes your request for /site1 and appends that to the DocumentRoot of the first VirtualHost. But since you don't have a /root/sites/site1/site1 directory, you get a 404 error.
There are a couple of alternatives.
You could run the two VirtualHosts on two different ports.
<VirtualHost *:80>
DocumentRoot "/root/sites/site1"
...
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "/root/sites/site2"
...
</VirtualHost>
Or, you could simply have a single site with a single document root:
DocumentRoot "/root/sites"
and then just structure your filesystem so that content for site1 goes under /root/sites/site1 and site2 under /root/sites/site2. Then the URLS http://192.168.1.8/site1 and http://192.168.1.8/site2 will work automatically.
You might also be able to do make some mod_rewrite rules, but that would start to get more complex.
I'm running Apache 2.4.6 on Ubuntu 13.
In sites-available, I have a conf file for my site that contains only this:
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin somebody#somewhere.com
ServerName www.ourco.me
ServerAlias ourco.me
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/ouruser/public/ourco.me/public
# Log file locations
LogLevel warn
ErrorLog /home/ouruser/public/ourco.me/log/error.log
CustomLog /home/ouruser/public/ourco.me/log/access.log combined
</VirtualHost>
There are no other conf files enabled. When I have use apachectl -S to display the sites, it shows:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server www.ourco.me (/etc/apache2/sites-enabled/ourco.me.conf:1)
port 80 namevhost www.ourco.me (/etc/apache2/sites-enabled/ourco.me.conf:1)
alias ourco.me
port 80 namevhost www.ourco.me (/etc/apache2/sites-enabled/ourco.me.conf:1)
alias ourco.me
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
The first thing I notice is the duplicate entry for namevhost www.ourco.me. And when I visit the site in a browser, I get:
You don't have permission to access / on this server.
Apache/2.4.6 (Ubuntu) Server at www.ourco.me Port 80
All the directories and files specified in the conf file exist. a2ensite and a2dissite work as expected to add/remove a symlink for this file from sites-enabled, so it's looking at the right file. Does anyone know why its directives are being ignored? Thanks.
Put Allow from all
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin somebody#somewhere.com
ServerName www.ourco.me
ServerAlias ourco.me
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/ouruser/public/ourco.me/public
# Log file locations
LogLevel warn
ErrorLog /home/ouruser/public/ourco.me/log/error.log
CustomLog /home/ouruser/public/ourco.me/log/access.log combined
Allow from all
</VirtualHost>
This appears to solve the problem:
<Directory />
Require all granted
</Directory>
when placed in the VirtualHost entry.
That snippet came from this post. I'm looking at this Apache doc to see why it works.