从头开始学Nginx----解决跨域并代理多个静态文件路径
可参考我的配置
server {
listen 80;
server_name localhost;
location / {
root /static;
index index.html index.htm;
# 解决跨域
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
}
location /video {
#使用alias关键字处理第二个静态文件路径
alias /static/video;
index index.html index.htm;
# 解决跨域
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
}