Server Fault is a question and answer site for system and network administrators. 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 want to use nginx for local development. This means I want to prevent other machines from being able to access my web server so it can only be accessed via localhost.

Under the server settings in sites-enabled/default I changed my code to

location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to index.html
        deny all;
        try_files $uri $uri/ /index.html;

Is there anything else I need to do to prevent third parties from accessing my web server?

share|improve this question
up vote 2 down vote accepted

On the NGINX side no, depending on how secure you want it to be you may also want to block port 80 (Or whatever port NGINX is running on) from any IP except local host, or use a non-default port (Something in the 8000-10000 range).

share|improve this answer
Thanks, I used ufw with the command: sudo ufw allow proto tcp from to any port 80 and then sudo ufw deny 80. BTW, in my MySQL config file I set the bind-address to Would this be sufficient now? I'm a bit paranoid because I learned yesterday that I had all the ports open all the time for MySQL and Apache while being connected to the Internet. Therefore, I re-installed my entire distro. Thanks again. – Frank Vilea May 25 '11 at 22:57
It can depend on your MySQL config and other factors on the network. Again I would block MySQL's port with the Firewall, or turn off networking altogether and just use a UNIX socket. – Smudge May 25 '11 at 22:58

Your Answer


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.