0

Is it possible to make my local nginx server private from the wifi network I use. I've juste realized that anybody can access my local webapp with the public ip the wifi network give to me (typing it in the browser), and I dont want that...

Thanks

Marc Delalonde
  • 335
  • 4
  • 17

2 Answers2

1

Yes configure it to bind the loopback IP address 127.0.0.1: listen 127.0.0.1:80;

Peter Lyons
  • 142,938
  • 30
  • 279
  • 274
  • Perfect but I still can access adding the port after the IP. Any idea ? – Marc Delalonde Nov 12 '14 at 11:21
  • Access from where? Are you really testing from a separate host? It's still going to be accessible to your machine itself. – Peter Lyons Nov 12 '14 at 11:32
  • For example currently my friend connected on the same wifi network as me can access my webapp typing my:public:ip:PORT. Before your change proposition he could access event without the port ! – Marc Delalonde Nov 12 '14 at 11:38
  • Sorry remote troubleshooting blind is too hard. Did you restart nginx? Did you edit the right file and server stanza? – Peter Lyons Nov 12 '14 at 12:00
1

Inside of the configuration file that can be located at /etc/nginx/nginx.confon most systems. Please locate the line that starts with listen and change that line to listen 127.0.0.1:80; to only allow requests from the local interface and to drop all other requests. so that your friend will no longer be able to access your server after that be sure to save that file. Then restart your server as Changes made in the configuration file will not be applied until the command to reload configuration is sent to nginx or it is restarted. To reload configuration, run the following command:

nginx -s reload
Mohammad Ali
  • 878
  • 8
  • 16