# 运维将本片段放入对应 server {},不要改应用 URL。 # ^~ 优先于正则,避免 /storage/uploads 下的脚本落入 PHP location。 # 路径以实际部署的 public 目录为准;若已做 public/storage 软链,用下面这段即可。 location ^~ /storage/uploads { add_header X-Content-Type-Options nosniff always; location ~* \.(php|phtml|phar|php[0-9]|pht|phps|shtml)$ { deny all; return 404; } }