Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running a MAMP stack on my iMac and I want to be able to access this server on any computer in my local network.

For now, I'm just forwarding localhost to port 80, but I'm pretty sure this makes my server accessible to anyone who knows my IP address.

How can I set it up to only be accessed on my local network?

share|improve this question
    
From your tags it sounds like there is a router involved somewhere. A bit more information about your network would be useful. –  heavyd Feb 8 '10 at 16:36

1 Answer 1

up vote 4 down vote accepted

If you're behind a router, and the port isn't forwarded, people outside shouldn't be able to access the MAMP server. If it's currently forwarded, take that off as people outside can indeed view it this way. If you want people on your network to access it, give them your local IP (192.168.x.x address). Then they can use the IP address itself, add a hosts file entry, or even use your hostname depending on your router.

An alternate solution is to add a Deny rule in httpd.conf in a Directory directive or in .htaccess:

Order Deny,Allow
Deny from all
Allow from 192.168.0.0/255.255.0.0

This way only local 192.168.x.x addresses in the 255.255.0.0 subnet can access the page for example.

See more on Apache Auth.

share|improve this answer

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.