Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created January 6, 2018 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlid/9268c266db71bd7c3d3578df391c83a3 to your computer and use it in GitHub Desktop.
Save ryanlid/9268c266db71bd7c3d3578df391c83a3 to your computer and use it in GitHub Desktop.
nginx跨域配置
location / {
root /var/www/lidong.me/www;
index index.html index.htm index.php;
# 配置允许cors跨域
if ($http_origin ~ '^https?://(lidong.me)') {
add_header 'Access-Control-Allow-Origin' "$http_origin";
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment