How to disable access to anyone not coming from a specific IP address

@pfaffman thank you for the pointers.

I fixed it :slight_smile: Here is solution in case someone needs it.

  1. ./launcher enter app from /var/discourse folder
  2. Go to '/etc/nginx/ folder and create file ‘whitelist-ip.conf’
  3. add below lines in ‘whitelist-ip.conf’ file
    allow 192.168.1.1;
    deny all;
  4. open /etc/nginx/conf.d/discourse.conf
  5. go to line no 37 see below section, it is for port 443
    server {
    include /etc/nginx/whitelist-ip.conf;
    }
  6. add line ‘include /etc/nginx/whitelist-ip.conf;’
  7. Test NginX configuration by running command ‘nginx -t’
  8. run ‘service nginx reload’

Try now, it will show not found page. no page related to discourse. from whiteliet ip address it will show normal forum.

4 Likes