0

I'm using nginx/1.12.0 and tried $server_addr directive but it gives me an error:

nginx: [emerg] invalid parameter "$server_addr" in /etc/nginx/sites-enabled/conf

Here is my code nginx conf block:

   location /login {
            deny all;
            allow $server_addr;
            auth_basic "Http Auth";
            auth_basic_user_file /etc/nginx/pass;
    }

Thanks in advance.

mirza
  • 101
  • 2
  • 3
    What are you actually trying to do? If you're wanting to limit connections so that they can only come from the server itself, you could just use `allow 127.0.0.1` surely? – Joe Brailsford Jun 24 '17 at 15:40
  • Hello @JoeBrailsford, allow 127.0.0.1; not working but allow ip.address; is working. That's why I'm trying to add server's actual ip address automatically. – mirza Jun 24 '17 at 21:13
  • That suggests 'ip.address' is not your Nginx host IP. Can you explain what exactly you're trying to achieve? – Joe Brailsford Jun 25 '17 at 21:27

0 Answers0