Tuesday, January 22, 2013

Apache 2.* only serve the first virtual host - Windows 7 + WAMP

This is a problem that cost me 3 days googling and searching every where without any hints or clues to the way that I should take to solve this problem.
But It was very easy if you try to stop thinking that google can solve all of yourproblems , just relax and try to solve it by yourself.
That's what I did , the server was running great for more than 6 months now, and suddenly I cannot reach my virtual hosts.
My  $1 million dollar advice to any one face such a problem or any other one is "First Check Log files".
What I had there is 


[error] (OS 11001)No such host is known.  : Could not resolve host name

And that means the system don't know how to reach the name domain that you write in the address bar. So the Problem was in Domain Resolution. that lead to host file.

When I checked the host file I cannot find any problem. All virtual hosts had their right IP addresses "127.0.0.1".
But Apache Said he cannot reach this file , means  there are security rules prevent apache from opening this file. 
Yes, It is a secured file by windows and to allow any application to use this file you have to give the application the right permissions. So Apache on windows to be able to read host file and run virtual host must be "Run As Administrator". That is it .

Long Road for Dummies like me , but a very good tutorial to know that I can solve things my self.

No comments:

Post a Comment