Skip to content

Accessing vhost from host only works with port forwarding #4

@NReilingh

Description

@NReilingh

I've been testing different networking configurations for vagrant so that I can access the guest server from a browser on the host machine. So far, the only thing I've gotten to work is if I use config.vm.network :forwarded_port, guest: 80, host: 4321, and then access http://localhost:4321 in a browser.

If I try to access 127.0.0.1:4321 in a browser, I get a 403 forbidden error. If I use a private_network setup with a hostname instead of forwarded_port, I get the same 403 error when accessing by IP, but accessing by the set hostname gets me Apache's default host (files in /usr/local/apache2/htdocs).

Ideally I would like to use a local hostname like dreambox.dev so that the project I'm working on can pretend that it has a hostname, but I haven't been able to figure out how to change apache's vhost configuration so that the /home/user DocumentRoot is served in all instances. I think that would be best because we can't guess at which networking configuration people will try to use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions