docker安装gogs
1、如果服务器没有安装docker,自行安装
2、拉取gogs镜像docker pull gogs/gogs
3、查看镜像:docker image ls
4、创建存储目录:mkdir -p /var/gogs
5、运行镜像,产生容器
5.1、普通运行:docker run --name=gogs -p 10022:22 -p 10080:3000 -v /var/gogs:/data gogs/gogs
5.2、后台运行:docker run --name=gogs -d -p 10022:22 -p 10080:3000 -v /var/gogs:/data gogs/gogs
6、域名及应用url设置
可以设置成同一个域名,域名解析到服务器ip,nginx添加反向代理
server{ listen 80; server_name www.mygogs.cc; charset utf-8; location / { proxy_pass http://127.0.0.1:10080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; proxy_set_header Connection "upgrade"; proxy_set_header Upgrade $http_upgrade; proxy_read_timeout 120s; } location = /favicon.ico { log_not_found off; access_log off; } }7、一定要设置管理员账号
8、后台运行gogs容器
8.1、查看container id:docker ps -l
8.2、启动gogs:docker start(stop rm) (container id)