Make my local nginx server private

193 views Asked by At

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

2

There are 2 answers

1
Mohammad Ali On BEST ANSWER

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
4
Peter Lyons On

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