时光沉淀

Gotosocial 0.18.0版本快速部署

· Views · By 浪子

在最新的0.18.0 版本中新增了可信代理 trusted-proxies

跟我当时使用的版本相比,已经增加了许多功能

譬如 开放了注册页面, 譬如 分域部署
需要注意的是 这种部署布局的配置必须在第一次启动 GoToSocial 前完成。

主要是通过重定向来实现.把原本请求到账户所属域名的流量转发到真实的实例地址上去.

server {
  server_name sgcd.net;                                                      # account-domain

  location /.well-known/webfinger {
    rewrite ^.*$ https://social.sgcd.net/.well-known/webfinger permanent;    # host
  }

  location /.well-known/host-meta {
    rewrite ^.*$ https://social.sgcd.net/.well-known/host-meta permanent;  # host
  }

  location /.well-known/nodeinfo {
    rewrite ^.*$ https://social.sgcd.net/.well-known/nodeinfo permanent;   # host
  }
}

如此就需要部署一个新的GTS实例
修改一下docker-compose.yaml中的配置

services:
  gotosocial:
    image: superseriousbusiness/gotosocial:latest
    container_name: gotosocial
    user: 1000:1000
    networks:
      - gotosocial
    pull_policy: always  
    environment:
      GTS_HOST: social.sgcd.net #实例地址
      GTS_ACCOUNT_DOMAIN: sgcd.net #用户账户所属的域名
      GTS_DB_TYPE: sqlite #使用sqlite数据库
      GTS_DB_ADDRESS: /gotosocial/storage/sqlite.db
      GTS_STORAGE_BACKEND: s3 # 使用S3存储 ,如果不需要可以删除包含STORAGE的环境变量
      GTS_STORAGE_S3_BUCKET: user #桶名
      GTS_STORAGE_S3_ENDPOINT: s3.bitiful.net  #S3端点
      GTS_STORAGE_S3_ACCESS_KEY: kmX5VsV8cB4ma8jeAg #
      GTS_STORAGE_S3_SECRET_KEY: DJ9qG7pNAZy9 #密钥
      GTS_STORAGE_S3_PROXY: true #代理S3,不会显示S3地址
      GTS_ACCOUNTS_ALLOW_CUSTOM_CSS: true #允许自定义CSS
      TZ: Asia/Chongqing #时区
      GTS_SMTP_HOST: mail.cock.li #smtp服务器
      GTS_SMTP_PORT: 587 #必须使用TLS
      GTS_SMTP_USERNAME: admin@cock.li #用户名
      GTS_SMTP_PASSWORD: ******  #密码
      GTS_SMTP_FROM: admin@cock.li #邮箱地址
      GTS_INSTANCE_LANGUAGES: zh #中文
      GTS_ACCOUNTS_REGISTRATION_OPEN: true #开放注册
      GTS_TRUSTED_PROXIES: 172.18.0.1/16 #可信代理
    ports:
      - "127.0.0.1:8080:8080"
    volumes:
      - ./data:/gotosocial/storage
    restart: "always"

networks:
  gotosocial:
    ipam:
      driver: default
      config:
        - subnet: "172.18.0.0/16"
          gateway: "172.18.0.1"

访问https://social.sgcd.net/@jkjoy
显示的账户所属的域名是sgcd.net
mastodon 可以通过 @jkjoy@sgcd.net 来添加好友

评论

0 条评论

暂无评论

Using $this when not in object context

Error: Using $this when not in object context in /app/data/plugins/FediverseSync/template/comment.php:3 Stack trace: #0 /app/data/plugins/FediverseSync/Plugin.php(989): require_once() #1 [internal function]: FediverseSync_Plugin::renderComments(Object(Widget\Archive), NULL) #2 /app/var/Typecho/Plugin.php(446): call_user_func_array(Array, Array) #3 /app/var/Widget/Archive.php(1274): Typecho\Plugin->__call('Widget_Archive:...', Array) #4 /app/data/themes/paper-main/footer.php(23): Widget\Archive->footer() #5 /app/var/Widget/Archive.php(1336): require('/app/data/theme...') #6 /app/data/themes/paper-main/post.php(51): Widget\Archive->need('footer.php') #7 /app/var/Widget/Archive.php(1418): require_once('/app/data/theme...') #8 /app/var/Typecho/Router.php(99): Widget\Archive->render() #9 /app/index.php(23): Typecho\Router::dispatch() #10 {main}