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 have just set up a wi-fi network at home. I have all my files on my desktop computer (192.168.1.56) and want to access localhost over there from another computer (192.168.1.2).

On my desktop I can access localhost through the normal http://localhost. Apache is running on port 80 as usual.

Exactly what do I have to do to achieve this? There is documentation on the net but they either don't work or are too fragment and confusing to understand.

I think I have to make changes to my apache's httpd.conf file and the hosts file. Any ideas as to what changes to make?

share|improve this question
add comment

closed as off-topic by Tom O'Connor Aug 14 '13 at 21:25

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Tom O'Connor
If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

localhost is the name given to the IP loopback address 127.0.0.1. Every computer in a network has a localhost address that points to itself. To access your files on your main computer you can use http://192.168.1.56. You could also edit the hosts file on the client(s) and assign a name to 192.168.1.56 edit /etc/hosts (unixlike systems) or %SystemRoot%\system32\drivers\etc\hosts for windows systems e.g.

192.168.1.56    homeserver.lan 

then you will be able to access the server as http://homeserver.lan

Edit: From the comments below, the port was being blocked by a firewall.

share|improve this answer
    
but I am not able to access 192.168.1.56 (the IP address is dynamic, does that make a difference?) or desktoppcname... i really doubt that making changes to the hosts file will make any difference... –  vr3690 Apr 3 '11 at 10:19
    
@vr3690: Check that your desktop pc will allow connections through it's firewall on port 80 (http). –  Iain Apr 3 '11 at 10:53
    
bingo. when i use 192.168.1.56 on desktop pc, i am able to see the site. so I am guessing I have a firewall problem. how do I fix this? –  vr3690 Apr 3 '11 at 10:56
    
@vr3690: You don't provide any information about the OS on your desktop PC. If it is windows have a look here –  Iain Apr 3 '11 at 11:10
    
yes. got it working. allowed port 80 limiting the scope to my subnet. thanks. –  vr3690 Apr 3 '11 at 11:13
add comment

Out of the box Apache's default vhost configs might offer something if you try this in your browser: `http://192.168.1.56'.

If that works look in the /etc/apache2/sites-enabled/000-default file (this may differ slightly on your OS) and change DocumentRoot to point to where the files you want to access are.

This isn't exactly secure if both machines are connected to the Internet but if you're not Port Forwarding on a NAT router to port 80 out to the Internet for serving Web pages then it's not the end of the world.

Remember to /etc/init.d/apache2 restart or similar after changes.

(It's probably worth saying at this point that using HTTP to share files across a LAN probably it's the obvious and ideal solution but the myriad of other solutions available are outwith this question most likely).

share|improve this answer
add comment

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