Forum: NGINX Allow directive with variables

Posted by justin (Guest)
on 2013-01-01 01:52
(Received via mailing list)
I am trying to use a variable with the `allow` directive, i.e.

    set $home_ip 1.2.3.4;

    location ^~ /apc/ {
      # Allow home
      allow $home_ip;

      deny all;

      include /etc/nginx/php.conf;
    }

But I am getting an error. Does the `allow` directive allow variables?

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,234600,234600#msg-234600
Posted by Maxim Dounin (Guest)
on 2013-01-01 22:31
(Received via mailing list)
Hello!

On Mon, Dec 31, 2012 at 07:51:21PM -0500, justin wrote:

>       include /etc/nginx/php.conf;
>     }
>
> But I am getting an error. Does the `allow` directive allow variables?

No, variables are not allowed within the "allow" directive
parameters.  If a parameter can contain variables, it's indicated
in a directive description.

Note well: it's bad idea to use variables to shorten configs, see
http://nginx.org/en/docs/faq/variables_in_config.html.

--
Maxim Dounin
http://nginx.com/support.html
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.