Translating apache config to nginx

Grant emailgrant at
Fri Feb 21 21:51:41 UTC 2014

>> Here is the description:
>> "deny access to files not containing a dot or starting with a dot in
>> all locations except installer directory"
> So: you want it to block /one and /two/, to allow /, and to block /.four, yes?

That's how I read it too.

>> Should the following accomplish this in nginx?  It gives me 403 during
>> normal operation.
> That configuration seems to get the first three correct and the last
> one wrong.
> If you add a "/" immediately after the first ^, it seems to get all
> four correct.
> What is "normal operation"? If the request you make is like /,
> it should be allowed; if it is not like / is should be blocked.

I just meant normal browsing around the inbox in Roundcube.

> (Personally, I'm not sure why you would want that set of restrictions. But
> if you want it, this is one way to get it.)
>> location ~ ^(?!installer)(\.?[^\.]+)$ {
>>     deny all;
>> }

I think the corrected directive is as follows?

location ~ ^/(?!installer)(\.?[^\.]+)$ {
    deny all;

- Grant

More information about the nginx mailing list