~franz/snippets

snippets/debian-gitea.md -rw-r--r-- 1.8 KiB
28b0e6dfFranz Geffke improved formatting 2 years ago

#Set-up Gitea on Debian

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install git nginx certbot -y
sudo adduser --disabled-login --gecos 'gitea' git
wget -O gitea https://dl.gitea.io/gitea/1.6.1/gitea-1.6.1-linux-amd64
chmod +x gitea
mkdir -p custom/conf
mkdir data
exit
sudo apt-get install supervisor -y
sudo mkdir /var/log/gitea
sudo nano /etc/supervisor/conf.d/gitea.conf

[program:gitea]
directory=/home/git/
command=/home/git/gitea web
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/gitea/stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/var/log/gitea/stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
environment = HOME="/home/git", USER="git"

sudo service supervisor restart
sudo systemctl stop nginx
certbot certonly --standalone --email email@yourdomain.com -d git.yourdomain.com
sudo nano /etc/nginx/sites-available/git.yourdomain.com

server{
		listen 80;
        server_name git.yourdomain.com;
        return 301 https://git.yourdomain.com$request_uri;
}

server{
        listen 443;
        ssl on;
        server_name git.yourdomain.com;
        ssl_certificate /etc/letsencrypt/live/git.yourdomain.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/git.yourdomain.com/privkey.pem;
        location / {
                proxy_pass http://127.0.0.1:3000;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                client_max_body_size 100M;
        }
}

sudo ln -s /etc/nginx/sites-available/git.yourdomain.com /etc/nginx/sites-enabled/
sudo systemctl start nginx