Allow directive with variables

Maxim Dounin mdounin at mdounin.ru
Tue Jan 1 21:31:09 UTC 2013


Hello!

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

> 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?

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



More information about the nginx mailing list