Gitea

来自MalacoKnowledge
imported>Malacology2022年5月25日 (三) 04:38的版本 (init)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

gitea是一个go语言构建的轻量代码托管解决方案,可作为GitHub的开源替代。

安装

# pacman -S gitea
# pacman -S sqlite

配置

$ vim /etc/gitea/app.ini

修改 app.ini 中需要更改的部分

nginx

新建/etc/nginx/sites-enabled/it.conf,注意替换 YOUR_DOMAIN YOUR_IP YOUR_KEY_FILE YOUR_CRT_FILE

server {
            listen 80;
            server_name YOUR_DOMAIN;
            return 301 https://$server_name$request_uri;
}
server {
    listen 443 ssl http2;
    server_name YOUR_DOMAIN;
    ssl_certificate YOUR_CRT_FILE;
    ssl_certificate_key YOUR_KEY_FILE;
    ssl_session_cache builtin:1000 shared:SSL:10m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;
    access_log /var/log/nginx/access.log;
    
    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://YOUR_IP:3000;
        proxy_read_timeout 90;
        proxy_redirect http://YOUR_IP:3000 https://YOUR_DOMAIN;
    }
}

自启

# systemctl enable gitea
# systemctl start gitea

主题

$ mkdir /var/lib/gitea/custom
$ mkdir /var/lib/gitea/custom/public
$ mkdir /var/lib/gitea/custom/public/css

下载主题

$ cd /var/lib/gitea/custom/public/css
$ wget https://raw.githubusercontent.com/acoolstraw/earl-grey/master/theme-earl-grey.css

修改app.ini添加

[ui]

DEFAULT_THEME = earl-grey

THEMES = gitea,arc-green,earl-grey

$ mkdir /var/lib/gitea/custom/public/img
favicon.png  logo.png  logo.svg