nginx:restrict_nginx_to_the_private_network
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
nginx:restrict_nginx_to_the_private_network [2019/12/01 10:42] – removed peter | nginx:restrict_nginx_to_the_private_network [2020/07/26 23:50] (current) – old revision restored (2016/10/07 17:00) 192.99.15.29 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== NginX - Restrict Nginx to the Private Network ====== | ||
+ | |||
+ | <code bash> | ||
+ | sudo vi / | ||
+ | </ | ||
+ | |||
+ | Inside, find the **listen** directive. You should find it twice in a row towards the top of the configuration: | ||
+ | |||
+ | <file / | ||
+ | server { | ||
+ | listen 80 default_server; | ||
+ | listen [::]:80 default_server ipv6only=on; | ||
+ | |||
+ | . . . | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | At the first listen directive, add your web server' | ||
+ | |||
+ | In our example, we'd modify the listen directives to look like this: | ||
+ | |||
+ | <file / | ||
+ | server { | ||
+ | listen 192.0.2.2: | ||
+ | |||
+ | . . . | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Save and close the file when you are finished. Test the file for syntax errors by typing: | ||
+ | |||
+ | <code bash> | ||
+ | sudo nginx -t | ||
+ | </ | ||
+ | |||
+ | If no errors are shown, restart Nginx to enable the new configuration: | ||
+ | |||
+ | <code bash> | ||
+ | sudo service nginx restart | ||
+ | </ | ||
nginx/restrict_nginx_to_the_private_network.1575196956.txt.gz · Last modified: 2020/07/15 09:30 (external edit)