SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы
НазадМетки: gogs fedora git nginx groupadd useradd systemctl
Устанавливаем Go
Примечание: требуется версия 1.14
wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.14.2.linux-amd64.tar.gz
cat << EOF > /etc/profile.d/go.sh export PATH=$PATH:/usr/local/go/bin EOF
Создадим пользователя
groupadd git useradd -m -d /home/git -s /bin/bash -g git -m git
su - git
Клонируем репозитарий и собираем
# Clone the repository to the "gogs" subdirectory git clone --depth 1 https://github.com/gogs/gogs.git gogs # Change working directory cd gogs # Compile the main program, dependencies will be downloaded at this step go build -o gogs
Первый запуск
./gogs web
Переходим по адресу http://IPorServerName:3000
Автозапуск
cp ./scripts/systemd/gogs.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable gogs
systemctl start gogs
custom/conf/app.ini
[server] PROTOCOL = unix HTTP_ADDR = /run/gogs/gogs.sock
/etc/tmpfiles.d/gogs.conf
d /run/gogs 0755 git git
nginx
location /git {
rewrite /git/(.*) /$1 break;
rewrite /git /$1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://unix:/run/gogs/gogs.sock;
}
Перезапускаем
systemd-tmpfiles --create systemctl restart gogs systemctl restart nginx