NGINX - allow `.well-known`
Because of:
```
# Deny access to . (dot) files
location ~ /\. {
deny all;
}
```
`.well-known/something` is also blocked.
Some third party services require to place files into the `.well-known` directory to do site ownership verification.
---
I did the following:
```
location ^~ /.well-known/ {
allow all;
}
# Deny access to . (dot) files
location ~/\. {
deny all;
}
```
this will:
* `.foo` **403**
* `.foo/` **403**
* `.foo/bar` **403**
* `.well-known` **403**
* `.well-known/` **403**
* `.well-known/foo` **404**
* `.well-known/some_exisitng_file` **200**
关闭于 2025-09-11 2 条评论