看了很多网上关于Nginx部署图片服务,都没讲清楚,所以我这边进一下操作。
server { listen 8081; server_name 0.0.0.0 large_client_header_buffers 4 16k; client_max_body_size 300m; client_body_buffer_size 128k; proxy_connect_timeout 600; proxy_read_timeout 600; proxy_send_timeout 600; proxy_buffer_size 64k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64K; charset utf-8; # root /root/data/arc/video location /video { alias /root/data/arc/video; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html }
图片/视频存放位置:/root/data/arc/video
浏览器访问url:http://ip:port/video/1111.jpg