docker + nginx起一个简单的图片服务器
转载
- 拉取官方nginx镜像
- 新建一个nginx.conf文件,编辑以下内容
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /images/ {
root /mnt/;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
charset utf-8,gbk;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
- 执行
docker run -d 18080:80 -v /Users/ss/Desktop/nginx/nginx.conf:/etc/nginx/conf.d/default.conf -v /Users/ss/Desktop/face:/mnt/images nginx:latest
本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。