I'm running a Centos6.4 box.
Running vagrant up
without the synced folder config in Vagrant file is fine. I can access on my host machine via http://localhost:8080
and it displays the Apache page. I could create index.html in /var/www/html
folder and it displays fine too.
However after adding the line below in the Vagrant file, visiting the page displays 403 Forbidden You don't have permission to access / on this server.
error instead:
config.vm.synced_folder "./source", "/var/www/html", :extra=>"dmode=777,fmode=777"
Going into the VM I see the permission set as below in /var/www
:
drwxr-xr-x. 6 root root 4.0K Jul 20 23:15 .
drwxr-xr-x. 18 root root 4.0K Jul 20 23:15 ..
drwxr-xr-x. 2 root root 4.0K May 14 06:12 cgi-bin
drwxr-xr-x. 3 root root 4.0K Jul 20 23:15 error
drwxrwxrwx. 1 vagrant vagrant 102 Jul 21 23:14 html
drwxr-xr-x. 3 root root 4.0K Jul 20 23:18 icons
So I tried setting apache ownership to it,
config.vm.synced_folder "./source", "/var/www/html", :owner=>"apache",:group=>"apache",:extra=>"dmode=777,fmode=777"
but that doesn't work too.
Apparently it has full read/write permissions and I have no clue why apache is complaining.
Figure out the user/group which runs httpd, make sure the user has execute permission on /var/www
and its subfolders.
Also, in you apache site configuration files, make sure you have correct directives for /var/www
, something like below
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Disable SELinux in the guest, it's useless to a development env
Edit /etc/selinux/config
Change SELINUX to disabled
SELINUX=disabled
Reboot the vagrant box => vagrant reload
See if #1 with #2 helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With