Published on December 29, 2020
Installation
Install Gitea:
apk add gitea
Configuration
Create the user and database:
createuser -U postgres --pwprompt gitea
createdb -U postgres --owner=gitea gitea
Start the service:
/etc/init.d/gitea start
rc-update add gitea
Forward the port using SSH:
ssh -L 3000:localhost:3000 example.com
Point your browser to http://localhost:3000/ and configure Gitea.
Edit /etc/nginx/sites-available/01_git.example.com
:
server {
listen 80;
listen [::]:80;
server_name git.codentium.com;
# Redirect HTTP traffic to HTTPS.
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name git.codentium.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem # managed by Certbot
index index.html;
# HTTP Strict Transport Security.
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
location / {
proxy_pass http://localhost:3000;
}
location /.well-known {
alias /var/www/example.com/htdocs/.well-known;
}
}
Create a symlink to enable the site:
ln -s /etc/nginx/sites-available/01_git.example.com /etc/nginx/sites-enabled/
Reload the Nginx configuration:
/etc/init.d/nginx reload
If you like my work or if my work has been useful to you in any way, then feel free to donate me a cup of coffee. Any donation is much appreciated!