本文共 2751 字,大约阅读时间需要 9 分钟。
gogs简介
mkdir -p ~/mysql/data ~/mysql/logs ~/mysql/confdocker run -p 3306:3306 --name mymysql -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6
MariaDB [(none)]> create database gogs default character set utf8;MariaDB [(none)]> grant all on gogs.* to 'gogs'@'%' identified by 'gogspass';
docker network lsdocker network connect dockeronlyofficenextcloudmysql_onlyoffice gogs
docker run -itd --name=gogs -p 10022:22 -p 10080:3000 -e TZ=Asia/Shanghai -v /volume1/docker/gogs:/data gogs/gogs
cat gogs/conf/app.ini
APP_NAME = Aiker EdwardRUN_USER = gitRUN_MODE = prod[database]DB_TYPE = mysqlHOST = mariadb:3306NAME = gogsUSER = gogsPASSWD = gogspassSSL_MODE = disablePATH = data/gogs.db[repository]ROOT = /data/git/gogs-repositories[server]DOMAIN = gogs.abc.comHTTP_PORT = 3000ROOT_URL = http://gogs.abc.com/DISABLE_SSH = falseSSH_PORT = 10022START_SSH_SERVER = falseOFFLINE_MODE = false[mailer]ENABLED = false[service]REGISTER_EMAIL_CONFIRM = falseENABLE_NOTIFY_MAIL = falseDISABLE_REGISTRATION = falseENABLE_CAPTCHA = trueREQUIRE_SIGNIN_VIEW = trueSHOW_REGISTRATION_BUTTON = false[picture]DISABLE_GRAVATAR = falseENABLE_FEDERATED_AVATAR = true[session]PROVIDER = file[log]MODE = fileLEVEL = InfoROOT_PATH = /data/log[security]INSTALL_LOCK = true # true关闭web配置向导,false打开web配置向导SECRET_KEY = NbSgKURfSaFxcdxW
server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name gogs.abc.com; ssl_certificate /usr/syno/etc/certificate/ReverseProxy/3a2b92d0-ea43-4c88-a7a0-e8be86104850/fullchain.pem; ssl_certificate_key /usr/syno/etc/certificate/ReverseProxy/3a2b92d0-ea43-4c88-a7a0-e8be86104850/privkey.pem; add_header Strict-Transport-Security "max-age=15768000; includeSubdomains; preload" always; location / { proxy_set_header Host $http_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_intercept_errors on; proxy_http_version 1.1; proxy_pass http://localhost:10080; }}
这样就可以通过https+域名访问了。
转载于:https://blog.51cto.com/m51cto/2387801