nginx跨域配置

server {

listen      80;

server_name  127.0.0.1;

#charset koi8-r;

#access_log  logs/host.access.log  main;

root C:\Users\xxxmz\Desktop\bigDATA;

location / {

root  html;

index  index.html index.htm;

}

#error_page  404              /404.html;

# redirect server error pages to the static page /50x.html

#

error_page  500 502 503 504  /50x.html;

location = /50x.html {

root  html;

}

location /api {

proxy_pass http://202.127.42.47:6010/sd/api/BDVarietyAuthorize/GetVarietyAnnouncementCountByYear;

proxy_set_header Host $http_host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_intercept_errors on;

}

location ~* \.(js|css|png|gif|jpg|mp3|ogg|ttf|woff|woff2|html|json|map)$ {

expires 30d;

}

你可能感兴趣的:(nginx跨域配置)