Reputation: 6371
I see something like this in several Rails install guides. What exactly are we doing here?
Add default subdomain to /etc/hosts, for example: "0.0.0.0 localhost.lan group1.localhost.lan group2.localhost.lan"
Upvotes: 0
Views: 8632
Reputation: 3085
You could either bind a domain/subdomain to localhost 127.0.0.1 or 0.0.0.0 to have an address which you can use in your browser to access your app.
When a service is listening on 0.0.0.0 this means the service is listening on all the configured network interfaces, when listening on 127.0.0.1 the service is only bound to the loopback interface (only available on the local machine).
So "0.0.0.0 localhost.lan group1.localhost.lan group2.localhost.lan" means "Please make the domains localhost.lan, group1.localhost.lan and group2.localhost.lan browsable and point them to all my network adapters".
Upvotes: 6
Reputation: 57640
It means all the domains and its aliases will point to all the IP addresses assigned to this machine.
So If you machine has 3 IP NIC and IP is assigned to each one. Then that line will point all the names to all of those 3 IPs.
Upvotes: 5
Reputation: 4617
If you are developing an app which requires a valid subdomain, the rails guide talk about adding that subdomain to the hosts file. so that they can route that request to your localhost(127.0.0.1)
example:
127.0.0.1 sampleapp.heroku.com
Upvotes: 1