Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provisioning with Apache + VBox default = 403 error #258

Open
khromov opened this issue Nov 20, 2015 · 5 comments
Open

Provisioning with Apache + VBox default = 403 error #258

khromov opened this issue Nov 20, 2015 · 5 comments
Assignees
Milestone

Comments

@khromov
Copy link

khromov commented Nov 20, 2015

When using Apache as the web server with "VBox default" synced folder , it breaks when you try to access http:// :

A 403 error is displayed. The following error is logged in /etc/apache2/error.log:

[Fri Nov 20 17:36:17.368514 2015] [core:crit] [pid 28666] (13)Permission denied: [client 192.168.66.1:60239] AH00529: /vagrant/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/vagrant/' is executable

Probably related to pemissions of the vagrant folder, since vagrant:vagrant owns the folder and Apache is run under www-data:www-data

@khromov
Copy link
Author

khromov commented Dec 21, 2015

Just got bitten by this again on a new machine.

The permissions for the /vagrant folder is:
drwx------ 1 vagrant vagrant 272 Dec 21 13:39 vagrant

Apache runs under www-data, so you'll get a 403 error by default when navigating to your vagrant IP or the hostname you picked. Not a great out-of-the-box experience.

This can be worked around by simply making sure the shared folder files are owned by www-data, like so:
config.vm.synced_folder "./", "/vagrant", owner: "www-data", group: "www-data"

I haven't done testing on alternative file systems or Nginx, but the line above should work for any standards-compliant shared folder implementation.

Could someone please review this? @naxhh

@naxhh naxhh self-assigned this Dec 21, 2015
@naxhh
Copy link
Contributor

naxhh commented Dec 21, 2015

ping @phansible/core-dev

I'm curious why you have this issue since was not reported by anyone else yet.
What is your OS, vagrant version and all that stuff.

I'll try to quick check this at home today.

@khromov
Copy link
Author

khromov commented Dec 21, 2015

@naxhh

Virtualbox 4.3.34, OSX 10.10.5, Vagrant 1.6.5

It's unlikely this behaviour changes between VBox / OS versions. It feels more likely that few people have used the combo:

  • VBox Default Synced folder type
  • Apache web server

If you try to provision a box with those settings, I'm confident the issue will emerge.

Edit: Added Vagrant version

@debo
Copy link
Member

debo commented Dec 26, 2015

@naxhh I'm honest, I'm not using apache since long time and I also generally use NFS sharing instead of vbox share. I'm going to run some test and see if I can replicate. /cc @khromov

@naxhh naxhh added this to the 0.7.3 milestone Dec 26, 2015
@debo
Copy link
Member

debo commented Feb 17, 2016

I didn't run any test yet but now that I read the various comments again it reminds me that yes, when you do use NFS share permissions are resolved automatically by vagrant which tries to match host and guest uuid but I'm quite sure that doesn't happen with synced folders. I'm still curious to know why an OSX user doesn't use NFS though... looking at @khromov ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants