location / { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Max-Age' 3600; if ($request_method = 'OPTIONS') { # OPTIONS 请求直接返回 200 return 204; } try_files $uri $uri/ /index.php?$query_string; }