Localhost subdomains with Ubuntu, Vagrant and Webrick

Hi there,

I’m using act_as_tenant gem and I would like to test it on my local environment.

I need to have entries like “app1.localhost”, “app2.localhost”, etc.

I’ve tried to set those entries on /etc/hosts: localhost app1.localhost app2.localhost


But http://app2.localhost:3000 does not respond.

Am I missing something?

P.S.: I’m using a vagrant running Ubuntu.

Thanks in advance

  1. Did you save the hosts file ?
  2. Did you restart your network ?

Yup, it’s saved. I checked it using

cat /etc/hosts


I also restarted ubuntu as a whole.