views:

33

answers:

1

Here is VDS server with ip(for example 105.123.123.123) with working apache service. And there is a desktop computer with linux on board(but really I presume there is no difference). I need to type on web browser address like someaddress.com and to see website situated at my server. My /etc/hosts:

127.0.0.1       localhost
105.123.123.123  someaddress.com
105.123.123.123 www.someaddress.com

But it doesn't work. I see real someaddress.com website. What can be wrong. It will be great if you help me with that.

P.S. Why I need this. There is one project with fixed links(like someaddress.com/inf). And I need to test it.

A: 

Maybe your distribution is preferring DNS over values in /etc/hosts. Check /etc/nsswitch.conf. It should have a hosts line something like:

hosts: files dns

Just make sure files comes before dns.

harlos
unfortunately nsswitch.conf contain correct information.My nsswitch.conf:passwd: compatgroup: compatshadow: compathosts: files mdns4_minimal [NOTFOUND=return] dns mdns4networks: filesprotocols: db filesservices: db filesethers: db filesrpc: db filesnetgroup: nis
andrii
I don't know then. It works for me. Maybe your browser is caching someaddress.com with out doing a lookup. Trying dropping the browser cache before hitting someaddress.com.
harlos
I have tried different browsers. But any way, thank you!
andrii