1

I'm running Apache/2.4.41 on Ubuntu 20.04. I'm trying to setup a virtual host. Neither Chrome nor Firefox are able to resolve hostnames specified in /etc/hosts file. Even before setting up the test.dev.conf file at /etc/apache2/sites-available, the browsers are not able to resolve the hostname. I'm trying to add test.dev.

Contents of /etc/hosts

127.0.0.1   localhost
127.0.0.1   test.dev
127.0.1.1   lakeguardians

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I'm able to ping the host though. Running the ping -c 5 test.dev gives the following output:

--- test.dev ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4073ms
rtt min/avg/max/mdev = 0.041/0.045/0.047/0.002 ms

Contents of /etc/nsswitch.conf

hosts:          files mdns4_minimal [NOTFOUND=return] dns

I've tried restarting apache2 and rebooting the system, but unable to solve the issue.

3
  • 1
    Hi, you need to use different domain extension, for example .local. The extension .dev is reserved by Google and this reservation is hard-codded within the most browsers.
    – pa4080
    May 3, 2020 at 16:31
  • 1
    Thank you! The comment solved the issue. I changed the hostname to test.local. One thing though, when I enter test.local in chrome, it asks if I meant test.local and shows the google search page. I'm able to access test.local after clicking the message. I want to know is there a way to bypass this message. Firefox didn't showed any message. I also tried testing some bizzare hostname but the message in chrome is persistent.
    – Mew
    May 3, 2020 at 16:50
  • Yes it did! Thank you very much!
    – Mew
    May 4, 2020 at 15:50

0

Browse other questions tagged .