#访问路径拼接img访问本地绝对路径下的某图片
location /img/ {
#跨域配置,如果不生效请先清除浏览器缓存数据
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
expires 30d;
#当访问https://server_name/img/路径时,就会访问本的/Users/chokshen/Desktop/img/文件夹
root /Users/chokshen/Desktop/;
error_log off;
access_log /dev/null;
autoindex on;
}