so I'm using vagrant across a couple of macs and PCs for local development.
The vhosts in puphpet/config.yaml
look like this
piYyhCPLFha4:
servername: iamsumit.dev
serveraliases:
- www.iamsumit.dev
docroot: /var/www/iamsumit/dist
port: '80'
setenv:
- 'APP_ENV dev'
override:
- All
options:
- Indexes
- FollowSymLinks
- MultiViews
engine: php
custom_fragment: ''
ssl_cert: ''
ssl_key: ''
ssl_chain: ''
ssl_certs_dir: ''
piYyhCPLFha5:
servername: relocation.dev
serveraliases:
- www.relocation.dev
docroot: /var/www/moovel/relocation-app/dist
port: '80'
setenv:
- 'APP_ENV dev'
override:
- All
options:
- Indexes
- FollowSymLinks
- MultiViews
engine: php
custom_fragment: ''
ssl_cert: ''
ssl_key: ''
ssl_chain: ''
ssl_certs_dir: ''
piYyhCPLFha7:
servername: einzl.dev
serveraliases:
- www.einzl.dev
docroot: /var/www/einzl/dist
port: '80'
setenv:
- 'APP_ENV dev'
override:
- All
options:
- Indexes
- FollowSymLinks
- MultiViews
engine: php
custom_fragment: ''
ssl_cert: ''
ssl_key: ''
ssl_chain: ''
ssl_certs_dir: ''
Now my problem is, that I can't get the middle vhost relocation.dev
to work on a specific mac (works perfect on all other machines).
The other vhosts are working perfectly. It's just that one vhost that won't work. The browser will just load very long and then show me a "website unavailable" message.
This is my hosts file:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
192.168.56.102 einzl.dev
192.168.56.102 boss.dev
192.168.56.102 iamsumit.dev
192.168.56.102 relocation.dev
192.168.56.102 nephalem.dev
192.168.56.102 polygoncreator.dev
192.168.56.102 car2clean.dev
192.168.56.102 elearning.dev
The docroot is correct. I can't imagine what is causing puphpet/vagrant to not recognize this one vhost. What could cause this behaviour?
After a lot more research, I found that these two lines (a necessary redirect) in the .htaccess
file caused the page to not load anymore:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
And why? Because the subdomain www.relocation.dev
wasn't in my hosts file.
Host file line should look like this:
192.168.56.102 relocation.dev www.relocation.dev
Now everything is working fine.
Thanks @v2p for your time.