server {
listen 80;
server_name localhost;
location /static {
root /var/www/webpage;
expires 30d;
add_header Cache-Control public;
access_log off;
# 加入如下内容,即可允许跨域访问static资源
add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
add_header Access-Control-Allow-Credentials true;
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-Max-Age 1728000;
}
....
}
带着使命来到世上的你,给他人提供价值,才有价值