docker run -it --rm -p 80:80 -v /var/data:/data jianbing/nginx_file
# 提供文件下载服务
FROM nginx
RUN echo " \
server {\n \
listen 80;\n \
server_name localhost;\n \
root /data;\n \
location / {\n \
add_header 'Access-Control-Allow-Origin' '\$http_origin' always;\n \
add_header 'Access-Control-Allow-Credentials' 'true' always; # 允许cookie\n \
add_header 'Access-Control-Max-Age' 1728000 always; # 缓存 预请求\n \
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;\n \
add_header 'Access-Control-Allow-Headers' '\$http_access_control_request_headers' always;\n \
if (\$request_method = OPTIONS) {\n \
return 204;\n \
}\n \
autoindex on;\n \
autoindex_exact_size on;\n \
autoindex_localtime on;\n \
}\n \
}\n" > /etc/nginx/conf.d/default.conf
Content type
Image
Digest
sha256:d1c7bc314…
Size
54.1 MB
Last updated
over 3 years ago
docker pull jianbing/nginx_file