0%

搭文件服务器

搭文件服务器

1
2
3
4
5
6
7
8
9
10
11
12
# docker-compose.yaml
version: '2'
services:
nginx:
image: nginx:1.13
ports:
- "8080:80"
volumes:
- "./nginx.conf:/etc/nginx/nginx.conf"
- "/root/debug_file/nginx_file_home:/usr/share/nginx/files"
command:
sh -c "ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo Asia/Shanghai > /etc/timezone && nginx -g 'daemon off;'"

同目录下新增 nginx.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
user root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name your.domain.com;
root /usr/share/nginx/files;
charset utf-8;
location / {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
}
}

启动容器

1
docker-compose up -d --force-recreate