Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've installed a LAMP server locally and I want it to only be accessible from my own computer (not even my local network), only through loopback. Is this possible to do securely? If so, how?

share|improve this question
up vote 7 down vote accepted

The Listen directive in your config should be equal to Listen 127.0.0.1:80

share|improve this answer
    
I looked at my /etc/apache2/httpd.conf (assuming this is the config file you mean) and I don't see any previous Listen commands. Am I in the wrong file? Pardon me for the noobness, first server setup. – n0pe May 22 '11 at 1:10
    
the apache config can be split into several files, depending on what distribution you are using. go to /etc/apache2 and do a grep Listen * -r. That will list the files with the Listen directive – freethinker May 22 '11 at 1:14
    
Conveniently located in Listen.conf! I've changed it and restarted the service. Is there a way to test this from my local machine? Without having to pick up another computer and trying? – n0pe May 22 '11 at 1:26
1  
you can do a netstat -nat | grep 80 and check whether port 80 is open on 127.0.0.1 or 0.0.0.0 or your ip address:80. For your case, it should be open only on 127.0.0.1 – freethinker May 22 '11 at 1:32
    
thanks a bunch @freethinker – n0pe May 22 '11 at 1:32

Tell the server to only listen on 127.0.0.1 and ::1.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .