After gogs is installed, manually go to /usr/local/src/gogs/ and directly execute ./gogs web to start gogs
But I found a lot of methods on the Internet about gogs configuration auto-start, but none of them work. My environment is centos7
One way is:
创建文件名/lib/systemd/system/gogs.service
内容
[Unit]
Description=gogs
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/src/gogs/scripts/init/centos/gogs start
ExecReload=/usr/local/src/gogs/scripts/init/centos/gogs restart
ExecStop=/usr/local/src/gogs/scripts/init/centos/gogs stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
But it can’t be started
2. In addition:
把/usr/local/src/gogs/scripts/init/centos/gogs拷贝到/etc/init.d/,并且增加x权限
But neither of them can be started using systemctl start gogs.service
Please refer to the following service to rewrite it, and then
systemctl enable gogs.service