。
文件结构为
- 更大的项目
- 不和谐-OAuth2
- 配置 <-- 不希望任何人访问此
- 静态<-- 图片在这里
- 不和谐-OAuth2
当我不包含底部 2 个位置规则时,我的图像会显示,但我的配置是可访问的。 当我输入以下规则时(我尝试了许多变体),我的图像返回 404,我的配置返回 403。
server {
listen 80;
location / {
include /etc/nginx/mime.types;
root /var/www/html/LargerProject;
index index.php index.html index.htm;
}
location ^~ /Discord-OAuth2/static/ {
allow all;
}
location ^~ /Discord-OAuth2/ {
deny all;
}
}
没有图像显示在我的网站上(使用Jinja的烧瓶服务器)我希望显示图像和返回 403 的配置
每个位置都应该是明确定义的操作。
在 ~ 正则表达式匹配位置,较长的路径将首先匹配。
server {
listen 80;
location / {
include /etc/nginx/mime.types;
root /var/www/html/LargerProject;
index index.php index.html index.htm;
}
location ^~ /Discord-OAuth2/static/ {
include /etc/nginx/mime.types;
root /var/www/html/LargerProject;
}
location ^~ /Discord-OAuth2/ {
deny all;
}
}