고그스

크로스 플랫폼 환경에서도 간편하게 설정할 수 있는, 간단하고 안정적인 자체 호스팅 Git 서비스.

접근

  • 브라우저를 열고 다음 주소를 방문하세요: https://<SERVER_IP>
  • 브라우저에서 SSL 경고가 표시될 수 있습니다(자체 서명 인증서).
  • Register a new account
  • The first registered account becomes Administrator

Disable Self-Registration (Optional)

By default, user self-registration is enabled.

1. Edit the configuration file: /etc/gogs/conf/app.ini

2. Under the [auth] section, change: DISABLE_REGISTRATION = false ~에 DISABLE_REGISTRATION = true

3. Restart Gogs:

systemctl restart gogs

중요한 파일 및 디렉터리

  • 설치 디렉터리: /opt/gogs
  • 구성 파일: /etc/gogs/conf/app.ini
  • 신청 정보: /var/lib/gogs
  • Repositories: /var/lib/gogs/repositories
  • 로그: /var/log/gogs
  • Systemd 서비스: /etc/systemd/system/gogs.service
  • Nginx 설정: /etc/nginx/sites-available/gogs.conf
  • TLS 인증서: /etc/nginx/ssl/

Git Usage

HTTPS (self-signed cert):

GIT_SSL_NO_VERIFY=true git clone https://<SERVER_IP>/<USERNAME>/<REPOSITORY>.git

SSH (Built-in server):

git clone ssh://git@<SERVER_IP>:2222/<USERNAME>/<REPOSITORY>.git

서비스 관리

Gogs:

systemctl status gogs
systemctl restart gogs

Nginx:

systemctl status nginx
systemctl restart nginx

PostgreSQL:

systemctl status postgresql
systemctl restart postgresql

메모

  • The main configuration file is located at /etc/gogs/conf/app.ini. After modifying the configuration file, restart the service using systemctl restart gogs.
  • The Nginx upload limit is defined in /etc/nginx/sites-available/gogs.conf using client_max_body_size. Increase it for large repositories and restart Nginx.
  • For large deployments, you may uncomment LimitMEMLOCK=infinity 그리고 LimitNOFILE=65535 in /etc/systemd/system/gogs.service, then run systemctl daemon-reload and restart Gogs.
  • Database credentials are defined in /etc/gogs/conf/app.ini.
  • For production use, it is recommended to replace the self-signed certificate with a valid Let’s Encrypt certificate.
  • If using a self-signed certificate, HTTPS cloning requires GIT_SSL_NO_VERIFY=true.

도메인에 SSL 활성화하기

1. 도메인을 서버 IP로 연결하십시오.

2. Update Gogs configuration (/etc/gogs/conf/app.ini):

EXTERNAL_URL = https://yourdomain.com/
DOMAIN = yourdomain.com
SSH_DOMAIN = yourdomain.com

3. Restart Gogs service to apply changes:

systemctl restart gogs

3. Edit Nginx config and replace both server_name <IP>; 귀하의 도메인과 함께 (<your-domain>HTTP(포트 80) 및 HTTPS(포트 443) 블록 모두에 대해:

vim /etc/nginx/sites-available/gogs.conf

4. Install Certbot:

apt install -y certbot python3-certbot-nginx

5. Run the following command to generate a valid Let’s Encrypt certificate:

certbot certonly --nginx --non-interactive --agree-tos --email [email protected] -d yourdomain.com

6. Replace SSL paths in Nginx config:

vim /etc/nginx/sites-available/gogs.conf
# Before:
    # ssl_certificate /etc/nginx/ssl/gogs.crt;
    # ssl_certificate_key /etc/nginx/ssl/gogs.key;
# After:
    # ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    # ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

7. Restart Nginx to apply the changes:

systemctl restart nginx

8. 브라우저를 열고 다음 주소를 방문하세요: https://yourdomain.com

신청 세부사항