centos配置gogs开机自启

东明兄 2021-06-12
0条评论 525 次浏览
东明兄 2021-06-120条评论 525 次浏览

gogs下载:https://gogs.io/docs/installation/install_from_binary

gogs提供的压缩包 提供了service文件,路径:

/scripts/systemd/gogs.service

gogs.service 默认配置如下:

[Unit]
Description=Gogs
After=syslog.target
After=network.target
After=mariadb.service mysqld.service postgresql.service memcached.service redis.service

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
User=git
Group=git
WorkingDirectory=/home/git/gogs
ExecStart=/home/git/gogs/gogs web
Restart=always
Environment=USER=git HOME=/home/git

# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
ProtectSystem=full
PrivateDevices=yes
PrivateTmp=yes
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

根据自己的情况进行修改,然后将gogs.service cp到 /usr/lib/systemd/system/ 目录下

启动:

systemctl start gogs.service

开机自启:

systemctl enable gogs.service

本文通过 YUQUE WORDPRESS 同步自语雀

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注