autoindex directive in 'if' section

Maxim Dounin mdounin at mdounin.ru
Thu Jan 26 19:21:19 UTC 2012


Hello!

On Thu, Jan 26, 2012 at 02:16:22PM -0500, B.R. wrote:

> Hello,
> 
> I would like to use the following in my conf file:
> location a/ {
>  if ($host ~* "") {
>   root "";
>   autoindex on;
>  }
> }
> 
> But that doesn't work: 'nginx: [emerg] "autoindex" directive is not allowed
> here'
> 
> What should I do?

http://wiki.nginx.org/IfIsEvil

Maxim Dounin



More information about the nginx mailing list