在 GOGS 下载并安装后,在程序目录下建立一个custom/conf/app.ini
的配置文件,内容如下:
APP_NAME = Gogs # APP名字
RUN_USER = git # 启动用户,设置后只能以此账号启动gogs
RUN_MODE = prod
[database]
DB_TYPE = mysql
HOST = 127.0.0.1:3306 # 数据库地址
NAME = gogs # schema
USER = git # DB用户
PASSWD = 123456 # DB密码
SSL_MODE = disable
PATH = data/gogs.db
[repository]
ROOT = /home/gogs/gogs-repositories # 仓库目录
[server]
DOMAIN = gogs.gg.com # 自定义的域名,对应Web路径
HTTP_PORT = 3000 # 端口,对应80端口的转发参考下面的配置
ROOT_URL = http://gogs.gg.com
DISABLE_SSH = true
SSH_PORT = 22
START_SSH_SERVER = false
OFFLINE_MODE = false
[mailer]
ENABLED = true
[service]
REGISTER_EMAIL_CONFIRM = true
ENABLE_NOTIFY_MAIL = true
DISABLE_REGISTRATION = false
ENABLE_CAPTCHA = true
REQUIRE_SIGNIN_VIEW = false
[picture]
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = false
[session]
PROVIDER = file
[log]
MODE = file
LEVEL = Info
ROOT_PATH = /home/gogs/log # 日志位置
[security]
INSTALL_LOCK = true
SECRET_KEY = qqvjujC4DTWjCi7320
[http]
ACCESS_CONTROL_ALLOW_ORIGIN = * # 跨域配置
nginx的转发配置
server {
server_name gogs.gg2.com gogs.gg.com;
listen 80;
#ssl on;
location /{
proxy_pass http://gogs.gg.com:3000; # 此处转发到3000端口
proxy_redirect default;
}
}