直接将 27行更换成如下配置即可 上图有示例
- if ( $static_fileAUWz2fmi = 0 )
- {
- add_header Cache-Control no-cache;
- add_header 'Access-Control-Allow-Origin' "$http_origin";
- add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type ';
- add_header 'Access-Control-Allow-Credentials' 'true';
- }
配置完成后,不重启Nginx也是可以用的,宝塔会自动重载配置。