location ~ .*\.(jpg|jpeg|gif|png|js|css|ico|eot|svg|ttf|woff|)$ { expires 30d; access_log /dev/null; valid_referers none blocked xxx; if ($invalid_referer){ return 404; } }