Forum Moderators: phranque

Message Too Old, No Replies

Setting server name in httpd.conf

Setting server name in httpd.conf

         

eowadmin

2:22 pm on Apr 15, 2009 (gmt 0)

10+ Year Member



Hello,

I am trying to modify httpd.conf on local windows machine. I do not want to use localhost as the server name, rather i want to use www.xyz.com.

I replaced occurence of localhost with www.xyz.com in httpd.conf and added following entry in c:\windows\system32\drivers\etc\hosts file

127.0.0.1 www.xyz.com

I restarted the apache. and tried to access www.xyz.com from the browser. But rather than displaying my local apache home page, it is displaying the actual site www.xyz.com contents.

Please help.
Thanks,
Brijesh

jdMorgan

2:35 pm on Apr 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you restart the browser as well?

Jim

eowadmin

3:45 pm on Apr 15, 2009 (gmt 0)

10+ Year Member



Yes I did.

coopster

3:55 pm on Apr 15, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Make sure you actually saved the hosts file after making your changes. You can also run this Windows command
ipconfig /flushdns

to flush the DNS resolver cache. Probably wouldn't hurt to flush your browser cache either.

jdMorgan

4:07 pm on Apr 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Good point, Coop. On Windows, I often run into the problem where the editor saves the file as "hosts.txt", leaving the previous (unedited) file as "hosts". So of course the machine keeps using the old file because the new one has an incorrect filename.

Jim

eowadmin

6:04 pm on Apr 15, 2009 (gmt 0)

10+ Year Member



Well thats not case with me. I edited hosts file and flushed DNS cache also.. But no luck.

jdMorgan

9:23 pm on Apr 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is very strange. Getting the hosts file to work is an everyday, trivial thing, and a large number of us do it all the time. So I'm mystified.

Are there any other 'complicating factors' involved here, such as a software firewall, anti-virus/anti-malware software -- any other programs that might be monitoring communications or have hooks into the TCP/IP stack on this machine?

Have you tried re-defining the IP address for other domains that exist? How about other domains that do not exist? How about defining your domain's IP address as something other than 127.0.01? What else have you tried?

Jim