0

On my linux pc i access webisite by going http://site1.local

I have setup virtual host in httpd.conf

I want that when i should be able to access that address from windows PC.

In the windows hosts file i have written

192.168.1.81 site1.local

But still i can't access the page.

i can ping that adress but not get the webpage to work

2
  • in your httpd.conf at your virtual host is it binded to 192.168.1.81 or all interfaces ? is your firewall blocking anything on your server by any chance ? you might want to say which OS youre using on both it might help others to answer you. every bit piece for information you can provide will help solving your problem.
    – Prix
    Aug 19, 2010 at 7:37
  • i am using centOS 5 , the virtualhost is binded to 127.0.0.1:80. I have checked iptables and haven't seen any rule blocking any PORT
    – John
    Aug 19, 2010 at 7:41

2 Answers 2

1

You can change your virtual host from 127.0.0.1 to your network ip which is 192.168.1.81:80 or you can make it *:80.

I would recommend the 2nd option so it will keep working on both, internaly on the server and within your internal ip.

The reason it won't work for your other computer is probably because it is bounded to 127.0.0.1.

So it would be:

NameVirtualHost *:80

<VirtualHost *:80>

The NameVirtualHost *:80 is needed so it won't let other sites conflict with each other, but make sure you have only one entry of NameVirtualHost in your httpd.conf or vhosts.conf.

5
  • i tried that but i still can't access from other computer
    – John
    Aug 20, 2010 at 0:06
  • You should put in your windows hosts file the exactly name you have inside your virtualhost ServerName in your apache server otherwise it won't know where the users wants to go. so for example if you have ServerName my.domain.com then at your windows hosts file you must make it 192.168.1.81 my.domain.com if that is the ip to your server
    – Prix
    Aug 20, 2010 at 3:11
  • forgot to say also make sure you have restarted apache to make the changes happen, service httpd restart
    – Prix
    Aug 20, 2010 at 3:30
  • i have done the same , i can ping that name but it does not open in browser , i have restarted apache aswell
    – John
    Aug 20, 2010 at 3:31
  • It might be a firewall issue then, but you already created a question about it so i will just go there and try to help you with what i can ;)
    – Prix
    Aug 20, 2010 at 4:30
0

It should be a matter of checking if apache is listening on port 80 with

sudo netstat -anp | grep :80

for which you should see your apache and IP:PORT that it is listening on.

If it listens on the right interface (or on all interfaces) then it can be a problem of the right firewall or name resolution on the other local station.

HOSTS file might be or not be fine, test if it works over http://192.168.1.81

You must log in to answer this question.