server {
listen 80;
server_name localhost;
location ~* \.(eot|otf|ttf|woff|woff2|svg)$ {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
}
access_log off;
listen 80;
server_name localhost;
location ~* \.(eot|otf|ttf|woff|woff2|svg)$ {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
}
access_log off;
}
参考文献:
nginx-docs:
http://nginx.org/en/docs/http/ngx_http_core_module.html#location
Nginx 的 Location 从零开始配置:
https://segmentfault.com/a/1190000009651161