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 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
        allow 127.0.0.1;
        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

1 Answer 1

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 127.0.0.1 to any port 80 and then sudo ufw deny 80. BTW, in my MySQL config file I set the bind-address to 127.0.0.1. 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. –  sam May 25 '11 at 22:58

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.