I\'ve been running Vagrant successfully for about a week. Last night I ran vagrant reload and now I can no longer access my sites.
cd /etc/apache2/sites-available
for file in `ls *`; do sed 's/\(.*<\/Directory.*>\)/Require\ all\ granted\n\1/' $file > $file.new;mv $file.new $file ; done;
because it worked before, I would not waste time on fix file by file
I had the same problem when changing the DocumentRoot.
Since you've changed your DocumentRoot to "/any/path/foo/bar", make sure you have the permissions set on "apache2.conf" for this path.
Search for:
<Directory /any/path/foo/bar>
in apache2.conf
And add a new block like this:
<Directory /any/path/foo/bar>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
And my guess is that everything is gonna be fine!
My hunch is that this is not a vagrant issue at all but solely an Apache configuration glitch. There are a few things I can think to check.
First, obviously, is to confirm that the user that apache is running under has read and execute permissions for the DocumentRoot folder.
Since you mentioned Apache 2.4, there have been changes in the configs from 2.2. Make sure your Allow from all
statements now read Require all granted
. (If you were still on 2.2, you'd want to make sure they said Allow from all
instead of Deny from all
.) In either case, you can set this in each <VirtualHost>
individually, or set a default in your <Directory />
block of the main httpd.conf
file.
Getting more obscure, you could check for selinux, although I'm pretty sure this isn't present in Ubuntu by default. (It is in CentOS, for example.)
This is solved and in the end came down to some very simple things.
/vagrant/Sites/default
, /vagrant/Sites/test
, /vagrant/Sites/real-site
All very basic things that eluded me for a better part of a week. I hope this can help someone else.