基于Docker和Nginx搭建HTTPS Git服务器
· 阅读需 3 分钟
使用到的工具:
- Docker Compose
- Nginx
- Git
- fcgiwrap
Docker Compose 配置
services:
nginx:
restart: always
container_name: nginx
user: root
image: nginx
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- 80:80
- 443:443
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/mine.types:/etc/nginx/mine.types
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/html:/etc/nginx/html
- ./nginx/screen:/etc/nginx/screen
- ./nginx/logs:/etc/nginx/logs
# 重要:
- /run/fcgiwrap.socket:/var/run/fcgiwrap.socket
# 这里不需要映射进去,因为 fcgiwrap 是运行在宿主机里面的
# - "/usr/lib/git-core/:/usr/libexec/git-core/:ro"
environment:
- NGINX_PORT=80
- TZ=Asia/Shanghai
privileged: true