server { listen 8088; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; #原文链接:https://blog.csdn.net/kjsayn/article/details/52385332 location ~ .*\.(gif|jpg|jpeg|png)$ { expires 24h; root C:/Users/ideal/Pictures/nginx-images/;#指定图片存放路径 access_log logs/images.log;#日志存放路径 proxy_store on; proxy_store_access user:rw group:rw all:rw; proxy_temp_path C:/Users/ideal/Pictures/nginx-images/;#图片访问路径 proxy_redirect off; proxy_set_header Host 127.0.0.1; client_max_body_size 10m; client_body_buffer_size 1280k; proxy_connect_timeout 900; proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 40k; proxy_buffers 40 320k; proxy_busy_buffers_size 640k; proxy_temp_file_write_size 640k; if ( !-e $request_filename) { proxy_pass http://127.0.0.1;#默认80端口 } } location / { root html; index index.html index.htm; }
}
在浏览器的地址栏中输入:
http://localhost:8088/84D775DF-032E-4FC9-89D3-79385BAF02CE.PNG
从本地读取图片并输出,成功了!!!