AWS EC2 run gogs by docker

install docker

1
sudo yum install docker

start service

1
sudo service docker start

create container

set ssh port && gogs port

1
sudo docker run  -dit --name=gogs -p 10022:22 -p 10080:3000 -v /var/gogs:/data gogs/gogs

install nginx

1
2
3
4
5
sudo yum install nginx

// nginx is available in Amazon Linux Extra topics "nginx1.12" and "nginx1"
// if get this message. do this:
sudo amazon-linux-extras install nginx1.12

nginx config

1
sudo vim /etc/nginx/conf.d/git.conf

git.conf
port is same with docker’s gogs port setting

1
2
3
4
5
6
7
8
9
10
11
12
13
upstream git {
server 0.0.0.0:10080;
}

server {
listen 80;
server_name yourdomain.com;

location / {
proxy_pass http://git;
index index.html index.htm;
}
}

remove default server from /ect/nginx/nginx.conf

start nginx

1
sudo service nginx start
#

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×