0

I've had an Apache Virtual Host working for a couple of month where workers on the office wifi could type in something like www.XYZ123.com and was able to access the website through their browser.

Now, it suddenly stopped working and am unsure of why it's not loading the page anymore.

I've googled extensively and couldn't find what went wrong, but I think it has to do with the hosts file in /etc/hosts.

I'm unsure of which ip I'm supposed to input beside www.XYZ123.com in the hosts file because whenever I run hostname -I or ipconfig -a, multiple IP address comes up and am unsure of which one I'm supposed to be using.

Anyone can clarify this problem to me?

1 Answers1

0

hosts file is a per-computer item. In order for everyone in your office to access the site, everyone needs to add the information to hosts file in their computer. This does not scale and is not maintainable.

I would recommend you to set up DNS for the service, so that there is a single point of truth for the location of the service.

However, if you still want to do it via hosts file, the format is as follows:

192.168.100.100 example.com

That is, IP address of the server and the domain name you want to associate with the server.

If there are multiple IP addresses in the same IP subnet, then there is something quite odd in the setup, and that needs to be fixed.

If the addresses are in different subnets, then you should choose an IP address that is in the same subnet as the other computers that need access to the website.

Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58