Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disallow access to all dot directories except .well-known?

Tags:

I've got this in my nginx config:

location ~ /\. {     deny all; }  location /.well-known/ {     allow all; } 

But I still can't access http://example.com/.well-known/acme-challenge/taUUGC822PcdnCnW_aADOzObZqFm3NNM5PEzLNFJXRU. How do I allow access to just that one dot directory?

like image 632
mpen Avatar asked Dec 14 '15 04:12

mpen


1 Answers

You have a regex location and a prefix location. The regex location takes precedence unless ^~ is used with the prefix location. Try:

location ~ /\. {     deny all; } location ^~ /.well-known/ { #   allow all; } 

See this document for details.

like image 139
Richard Smith Avatar answered Sep 22 '22 19:09

Richard Smith