Nginx拒绝位置中的特定文件类型
例如,我想拒绝位置/文件的文件类型html/ 我的配置中有另一个位置块,如下所示:Nginx拒绝位置中的特定文件类型,nginx,Nginx,例如,我想拒绝位置/文件的文件类型html/ 我的配置中有另一个位置块,如下所示: location~*\.exe${ 别名/var/www/test.html; } 它成功地拒绝了.exe文件的输出,但它是全局的,我只想拒绝/files/位置的html文件,但它不起作用 有人有建议吗?您可以在nginx中嵌套位置 location /files/ { #put your /files/ location config here #This is a nested locati
location~*\.exe${
别名/var/www/test.html;
}
它成功地拒绝了.exe文件的输出,但它是全局的,我只想拒绝/files/位置的html文件,但它不起作用
有人有建议吗?您可以在nginx中嵌套位置
location /files/ {
#put your /files/ location config here
#This is a nested location with your regex
location ~* \.exe$ {
alias /var/www/test.html;
}
}
您可以在nginx中嵌套位置
location /files/ {
#put your /files/ location config here
#This is a nested location with your regex
location ~* \.exe$ {
alias /var/www/test.html;
}
}