# 静态文件处理 - 优先级最高
location ^~ /uploads/ {
expires 30d;
access_log off;
add_header Cache-Control "public";
try_files $uri =404;
# 确保不执行 PHP
location ~ \.php$ {
deny all;
}
}
location ~* \.(?:jpg|jpeg|png|gif|bmp|webp|ico|svg|woff|woff2|ttf|eot|otf|css|js|map|json|txt|pdf|zip|gz|tar|mp3|mp4|webm)$ {
expires 30d;
access_log off;
add_header Cache-Control "public";
try_files $uri =404;
}