Windows 8 dns hosts file not doing what it is supposed to - dns

I changed my hosts file at:
C:\Windows\System32\drivers\etc\hosts
to
127.0.0.1 localhost
127.0.0.1 www.david.com
everything else is commented with #
I clean the dns with ipconfig /flushdns
However when I put on my chrome browser www.david.com it does not go to my localhost.
What am I doing wrong?
I also tried to ping the server but it does not ping my localhost.

You are not supposed to use the www in the hosts file.
Your hosts file should look like this
127.0.0.1 localhost
127.0.0.1 david.com
When you change the hosts file you need to restart the dnscache service like this
Launch a Windows command windows using the 'Run as Administrator' menu option and then do
net stop dnscache
net start dnscache
Then use david.com in the browser.
For some reason the www. is ignored even if you add it.

Related

How to configure apache in local development in rails

I am trying setup a loacl domain on my pc for that I have apache server install I want to open my rails s inside this abcd.com instead of 127.0.0.1:3000. In my host I have changed host file like this:
127.0.0.1 localhost
127.0.0.1 abcd.com
But when I am trying to open abcd.com with this command I am getting this message:
Address already in use - bind(2) for "127.0.0.1" port 80 (Errno::EADDRINUSE)
When I stop apache it works on localhost any help
You need to write all hostnames behind the ip like this :
127.0.0.1 localhost abcd.com

Rename localhost 127.0.0.1, in LAMP stack

I am using a LAMP stack. Will there be problems if I update the /etc/host file to reflect 127.0.0.1 as somename from localhost?
Thanks!
Edit:
I sometimes work in remote sites with no network. I have the same setup on different machines and I need the server name to know dynamically where to do changes, etc.
I edited /etc/hosts to show
127.0.0.1 localhost somename
Now, with my Wifi off I am trying http://somename and it is not connecting. If I turn my wifi on, it works. But I need it to work with no connection. How can I resolve this?
No. Just add somename after localhost separated by space in /etc/hosts. You can add as many aliases as you like, as long as you don't delete localhost.

Apache IP address working but localhost does not

I downloaded Apache2 and it is currently running. I typed in my IP address and it brings me to the "It Works!" page, however when I type in localhost or 127.0.0.1 I receive an error. Can someone tell me whats up?
check 127.0.0.1 able to ping or not with same machine.
check /etc/hosts file having 127.0.0.1 entry or not?
check in apache configuration file Listen 0.0.0.0:80 or not?

Webmin local development with name based virtualhosts

Hi i am trying to name based virtual hosts for my localhost.I was using wamp with name based virtualhost before but now im working on ubuntu.I thought webmin can be easy but when i create first virtual host all requests redirecting first virtual host even localhost,second virtualhost and phpmyadmin.
So how can i set webmin for reach each of them separately.
hosts config
127.0.0.1 www.adres1.com #working fine
127.0.0.1 adres1.com #working fine
127.0.0.1 www.adres2.com
127.0.0.1 adres2.com
Its because you are using a local server and your all domain will by default search 127.0.0.1 or your IP. So untill you declair them as CNAME in your zone file or do a entry in host file, they all will work as alias of a single domain. Thanks... :)

Access two sites hosted on my IIS server with the same port?

I currently have two websites hosted on my IIS 7 server. Each website has its own host name but shares the same port (80).
Everything works great locally to access the two sites:
Site #1: http://localhost/ -> http://arcadiastudio.ch
Site #2: http://webService.ch/
But from the outside I cannot reach my second website hosted on the same port. I do not know what to put in the URL:
Site #2: http://arcadiastudio.ch/??
Here is what I have in my host file:
127.0.0.1 localhost
127.0.0.1 webService.ch
::1 localhost
This should be very simple. All you need to do is to have each hostname specified in your hosts file. In your case, your host file on your local PC should look like:
127.0.0.1 localhost
127.0.0.1 webService.ch
::1 localhost
127.0.0.1 arcadiastudio.ch
And the hosts file on your remote PC should look like:
127.0.0.1 localhost
<remote_ip> webService.ch
::1 localhost
<remote_ip> arcadiastudio.ch
Obviously, you need to change <remote_ip> to the IP address of your web-server.
Also, if you want to allow any remote PC to connect, you will need to register your domain names for DNS - you can't edit every host file in the world!!

Resources