0

I have Apache installed and the server directory index was accessible using http://localhost before I recently installed a new Dlink ADSL2+ Modem+Router . Now the apache web server contents are only accessible using the address 127.0.0.1 in the web browser. Using http://localhost displays a "403 Forbidden (nginx)" message. When I unplug my ethernet cable from the PC and restart networking , localhost leads to the apache index.

I have tried assigning a new domain name 'localwebserver' in the /etc/hosts file to 127.0.0.1 but then the browser displays a message "Critical error: no domain selected!"

My /etc/hosts file

127.0.1.1 avinash-ubuntu
127.0.0.1 localhost
127.0.0.1 localwebserver

# 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

My /etc/network/interfaces file

auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp

nslookup localhost :

Server:     127.0.0.1
Address:    127.0.0.1#53

Non-authoritative answer:
Name:   localhost.home.network
Address: 185.53.179.7

What could possibly be changed when I plug in the new router? How can I get localhost to display the apache index? Haven't found any option on the modem config page that seems related (to my knowledge)

Thanks

2
  • Could you share result of nslookup localhost Commented May 12, 2017 at 9:57
  • I have added it in the post
    – Parapan
    Commented May 12, 2017 at 10:17

1 Answer 1

0

Looks like your DHCP server add search directive in your /etc/resolve.conf. And host with name localhost.home.network exist in Internet, so you try to connect to it instead of your host. Try to change DHCP configuration on your router(change domain from home.network to something else, like myhome.local).

2
  • I am not sure how that setting was affecting this but I changed the interfaces setup to static for now anyways and the search entry has been removed from resolv.conf. Works fine now, thanks
    – Parapan
    Commented May 12, 2017 at 11:06
  • 1
    Microsoft discourages (as do I) using the TLD .local - the proper method is to use a domain or subdomain you have full control over. Commented May 12, 2017 at 11:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .