Local web server Access - Bad gateway error

I have apache2 installed on my WinXP machine. I have configured name based virtual sites on the server. When I am not connected to the internet (my network cable is unplugged) I can navigate to my local websites using both IP and site name. When I connect to the internet, then try navigate to my local websites using either IP or named (http://mylocalwebsite.xxx) url I get the following error:

Bad Gateway
The following error occurred:
[code=DNS_HOST_NOT_FOUND] The host name was not found during the DNS lookup. Contact your system administrator if the problem is not found by retrying the URL.

Please contact the administrator.

Thanks for your help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try setting your computers IP adress ad primary DNS server in TCP/IP properties and your ISP's DNS as secondary. It seems to me that when you are connected to internet you use ISP's DNS and that DNS has no record of your 'virtual sites'.

Hope this helps.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mainameAuthor Commented:
Thanks for the suggestion. However, that sounds a little tricky - reason being:

- my computers' IP address is dynamic (it is issued by my router whenever I boot the PC up). Since I have more that one computer utilizing the router the IP for the PC with the problem will not always be the same.

I want to keep my router configured as a dhcp server. What are the possibilities?

you can set static IP adress to computer that is running apache and reserve that ip adress on router. than add that ip adress to list of DNS servers on your router ( i think that your router shoul have this options). That way you can keep dhcp on your router.

Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

the issue that you are dealing with is one of name resolution.

when your computer is connected to the network and has internet access it is going to use the upstreasm dns to resolve all domain name requests that it doesn't already know about.

you can add hosts to your hosts file and your machine "should" look at them before making a query of a DNS server.

since your ip address is changing, i would try to configure them to work with your loop back ip address.

in your hosts file add something like this:           vhost1.mydomain.com           vhost2.mydomain.com           vhost3.mydomain.com           vhost4.mydomain.com


mainameAuthor Commented:
I tried making the changes you suggested. I may not have done it correctly because I lost all ability to connect to any sites - whether local or remote (web servers). At this point I just reverted back to my initial settings. The strange thing is that once the old settings were reinstated and my PC was rebooted I no longer had my initial problem. I can now access my local sites (and also remote sites) when connected to the internet. So nowI have the functionality I was looking for without any specific resolution....hmmm.

My host file has all the entries for the local sites that I have configured on my PC (This was the case from the get go when I had my initial problem).

Anyway, I seem to be up and running as I desire to be. However, I have no conclusive info on exactly what caused the problem and how I resolved it.
mainameAuthor Commented:
Okay guys I was just awaiting any comments on the unexplained resolution to my problem. If anything dawns on yous pass on the wisdom. In all honesty I am at a loss of what resolved my problem - I will try and dig more from PC logs. At least it works now. I guess there's not point in keeping the thread open. Thanks a lot for your responses.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.