personal music website
1.0.0
本项目在B站SpringBoot + Vue音乐网站项目的基础上做了以下优化:
找到listen 80,然后在它下面添加或替换如下配置
listen 80;
server_name localhost;
sendfile on;
keepalive_timeout 65;
charset utf-8;
#access_log logs/host.access.log main;
location / {
add_header 'Access-Control-Allow-Origin' $http_origin;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,web-token,app-token,Authorization,Accept,Origin,Keep-Alive,User-Agent,X-Mx-ReqToken,X-Data-Type,X-Auth-Token,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
root /upload/;
index index.html index.htm; # 需要转发的url地址
}
location ^~/api/ {
proxy_pass http://localhost:8889/;
}
location ^~/apk/ {
proxy_pass http://localhost:8889/admin/;
}