Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've setup a Apache web server on Ubuntu Linux. I can see it as http://localhost and http://192.168.1.101 and http://default.local/. All work well. But I can't see localhost from other machines in my network using IP address: http://192.168.1.101 or http://default.local/

I also have added 192.168.1.101 to both computers' /etc/hosts/

I added the lines below to my apache conf:

`Allow from 192.168.1`

but it did not work. It says "the connection has timed out".

what should i do?

PS:

adp@adp-desktop:~$ sudo netstat -ap | grep apache
tcp        0      0 *:www                   *:*                     LISTEN      10581/apache2   
tcp        0      0 localhost:www           localhost:46017         ESTABLISHED 10586/apache2   

Apache conf:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName default.local    
    DocumentRoot /home/www/public_html
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /home/www/public_html>
        Options Indexes FollowSymLinks MultiViews
        #AllowOverride None
        AllowOverride all
        Order allow,deny
        allow from all

    </Directory>
share|improve this question
1  
What does the Listen directive say ? –  Iain Dec 24 '10 at 11:55
    
it listens 80... as i said everything is OK. it just can't be seen from other computers. –  takpar Dec 29 '10 at 5:36
add comment

1 Answer

I'm not sure if this is clear for you but the hostname localhost is a local alias on every machine pointing to 127.0.0.1 which is the local loopback interface. It is therefore only accessible from the local machine.

When you have such problem, what you want to do is check what IP the Apache socket is bound to. In order to do this, you can use netstat -ap | grep apache. This will give you a line containing either locahost:80 or *:80. Note that the port number may be replaced by a more intelligible name such as http.

The first one will mean that Apache is only bound to the local interface therefore can't be reached from other computers on the network. The first one will mean that Apache can be reached from the network providing that traffic flows are allowed and fucntionnal (no firewall per example).

EDIT : Considering the configuration you posted, you should check network connectivity. Make sure both PCs can ping each other and make sure you are trying to access the correct IP.

share|improve this answer
    
thanks. i run your command, and added to question. will you check it and tell what does it mean? –  takpar Dec 24 '10 at 11:47
    
can you also post you Apache configuration ? –  Antoine Benkemoun Dec 24 '10 at 11:55
    
yes, i did. please check the question. –  takpar Dec 24 '10 at 12:09
1  
If you've posted your entire apache.conf you've got a real problem. That looks more like a vhost.conf file. –  Andrew Taylor Dec 24 '10 at 12:39
    
you ar right. i set ServerName to my conf. now it is accessible view default.local too. and i set it in my laptop's hosts file. but the problem persists. –  takpar Dec 24 '10 at 15:29
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.