nginx 配置文件编辑
cat static-vcnas-bind.example.conf
server { listen 80; server_name static-vcnas-bind.example.com; #ssl #ssl_certificate conf.d/keys/static-vcnas-bind.example.com_bundle.crt; #ssl_certificate_key conf.d/keys/static-vcnas-bind.example.com.key; #js/css CDN location /assets/ { #跨域支持 # 配置跨域 后面的*可以换成自己的域 *表示统配 add_header 'Access-Control-Allow-Origin' '*'; # 访问是否携带Cookies add_header 'Access-Control-Allow-Credentials' 'true'; # 允许跨域的方法 add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, OPTIONS'; proxy_pass https://www.source-domain.com/assets/; } location / { root index.html; } }
解释
static-vcnas-bind.example.com 该域名为腾讯cdn配置的汇源域名
www.source-domain.com 该域名是真实目标源域名
注意:配置好
location / { root index.html; }
否则可能访问到其他地方
http://blog.xqlee.com/article/1720372451310833666.html