Skip to content

WeiXuG-2023/docker-compose-nginx-gogs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Private GOGS ( github-clone ) served through HTTPS via NGINX

Requirement

Build

After installing the requirements, run inside this directory:

docker-compose up

First run

Self-signed certificates using gogs

During the first run, the nginx container webserver will complain that no certificates are available and will quit. (But gitserver will keep running.)

To solve that, open a terminal and execute (replace (gitserver) with the name of the container as printed by docker-compose up call):

docker exec -it (gitserver) bash

This will connect you to the running gitserver container and will launch an instance of bash inside it. Then enter (replace again (hostname) here with your domain name):

cd /data/gogs/conf/
/app/gogs/gogs cert -ca=true -duration=8760h0m0s -host=(hostname)
exit

That's it. You now have self-signed certificates by gogs. You can now restart the failed container:

docker-compose up

Autorithy signed certificates

If you already have signed certificates, just copy them into: /var/gogs/gogs/conf in your local system. They will automatically mounted during when docker-compose is launched.

Remember to rename the certificate: cert.pem, and the server key: key.pem.

Usage

You can now acces you self-hosted gogs service through HTTPS using any browser. You'll get a warning however as the certificate are self-signed.

git through self-signed HTTPS

To use git with a self-signed, you need to disable SSL verification temporarly:

export GIT_SSL_NO_VERIFY=true

or permanently (:warning: DANGEROUS 🚷):

git config --global http.sslverify false

git through ssh on a different port (10022)

To use git with ssh on a different port than the default port 22:

git clone ssh://git@hostname:10022/user/repo.git

Remember to add your ssh keys first!

References

About

Private GOGS served thru HTTPS w/ NGINX

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nginx 100.0%