2

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?

2 Answers 2

7

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

4
  • 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, 2011 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 May 22, 2011 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, 2011 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 May 22, 2011 at 1:32
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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