How can I allow access to a single IP address via Nginx.conf?

前端 未结 2 549
春和景丽
春和景丽 2020-12-07 16:18

Nginx, Passenger, and Rails are running beautifully on my Linode. Before I launch, I\'d like to restrict access so only my IP can view the site.

I\'ve tried to deny

相关标签:
2条回答
  • 2020-12-07 17:11

    I know this is an old tread, but you an always use sudo nginx -t to get a more specific error message.

    0 讨论(0)
  • 2020-12-07 17:16

    modify your nginx.conf

      server {
        listen 80;
        server_name www.foo.bar;
    
        location / {
          root /path/to/rails/public/;
          passenger_enabled on;
    
          allow   my.public.ip.here;
          deny    all;
        }
      }
    
    0 讨论(0)
提交回复
热议问题