Matrix Synapse VPS: Chat Self-Hosted An Danh
Matrix la giao thuc chat phi tap trung voi end-to-end encryption (E2EE) va federation - tuong tu nhu email nhung cho chat realtime. Khac voi Slack, Discord hay Telegram, Matrix khong co server trung tam co the bi shutdown hoac yeu cau cung cap du lieu. Tu host Matrix Synapse tren VPS offshore mang lai cho ban va cong dong mot kenh giao tiep an toan, khong bi kiem duyet va hoan toan duoi su kiem soat cua ban. AnubizHost cung cap VPS Iceland phu hop chay Synapse voi bao mat phap ly, thanh toan crypto va khong KYC.
Need this done for your project?
We implement, you ship. Async, documented, done in days.
Vi Sao Tu Host Matrix Thay Vi Discord/Slack
Discord va Slack co dieu khoan dich vu cho phep ho ban hanh ki luat tai khoan, doc nguoi dung, va cung cap du lieu cho co quan thi hanh phap luat. Khi cong dong cua ban hoat dong trong linh vuc nhay cam (bao chi, hoat dong, nghien cuu chong giam sat), nhung dieu khoan nay la rui ro nghiem trong.
Matrix Synapse self-hosted mang lai 5 loi the:
- End-to-end encryption mac dinh: Tin nhan duoc ma hoa client-side voi Megolm. Ngay ca admin server khong doc duoc.
- Federation: Server cua ban co the giao tiep voi cac Matrix server khac. User Element.io co the chat voi user tren server cua ban va nguoc lai.
- Cong dong khong bi shutdown: Server tren VPS Iceland thuoc kiem soat cua ban. Khong ai co the gioi thieu noi quy moi hay xoa toan bo lich su chat.
- Bridge sang nen tang khac: Matrix co bridge cho IRC, Telegram, Discord, Slack, WhatsApp. User cua ban giao tiep voi user nen tang khac ma khong roi Matrix.
- Tuy bien khong gioi han: Bot, widget, custom client - tat ca duoc cong dong open-source phat trien.
VPS Pro AnubizHost voi 4GB RAM du chay Synapse cho cong dong 100-500 user. Voi cong dong lon hon hoac federation rong, mo rong sang Pro+ hoac dung PostgreSQL doc lap.
Cai Dat Matrix Synapse Voi Docker Compose
Cach don gian nhat la dung Docker Compose. Tao thu muc /opt/matrix va file docker-compose.yml:
version: '3'
services:
postgres:
image: postgres:15
environment:
POSTGRES_USER: synapse
POSTGRES_PASSWORD: strong_db_password
POSTGRES_DB: synapse
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C"
volumes:
- ./postgres:/var/lib/postgresql/data
synapse:
image: matrixdotorg/synapse:latest
environment:
SYNAPSE_SERVER_NAME: matrix.yourdomain.com
SYNAPSE_REPORT_STATS: "no"
volumes:
- ./synapse:/data
ports:
- "127.0.0.1:8008:8008"
depends_on:
- postgres
Generate config dau tien:
docker compose run --rm synapse generate
# Sua synapse/homeserver.yaml:
# database: PostgreSQL connection
# registration_shared_secret: random_secret
# enable_registration: false (de chong spam)
docker compose up -d
Cau hinh Caddy reverse proxy voi HTTPS auto:
matrix.yourdomain.com {
reverse_proxy /_matrix/* 127.0.0.1:8008
reverse_proxy /_synapse/client/* 127.0.0.1:8008
}
matrix.yourdomain.com:8448 {
reverse_proxy 127.0.0.1:8008
}
Tao user dau tien:
docker compose exec synapse register_new_matrix_user \
-u admin -p strong_admin_pass -a -c /data/homeserver.yaml http://localhost:8008
Truy cap qua Element web app tai app.element.io hoac client mobile va connect den matrix.yourdomain.com.
Federation, Bridge Va Bao Mat Production
Federation: Mac dinh Synapse cho phep federation. Test bang federation tester tai matrix.org. Neu can chan federation voi mot server cu the (vd ban spam), them vao homeserver.yaml:
federation_domain_whitelist:
- matrix.org
- element.io
# hoac blacklist:
federation_ip_range_blacklist:
- '127.0.0.0/8'
- '10.0.0.0/8'
Bridge sang Telegram/Discord: mautrix-telegram va mautrix-discord cho phep user Matrix gui/nhan tin nhan tu cac platform khac. Cai dat Docker container va connect vao Synapse qua application service registration.
Bao mat production:
- Tat registration mo:
enable_registration: false, dung registration token hoac email invite. - Captcha: Bat hCaptcha hoac Turnstile de chong bot tao acc.
- Rate limit: Trong config bat
rc_messagevarc_registrationde chan spam. - Media retention: Tu dong xoa media cu de tiet kiem dia:
media_retention.local_media_lifetime: 90d. - Backup PostgreSQL: Pg_dump hang ngay, ma hoa va day sang storage offsite. Mat database = mat toan bo lich su chat.
Monitoring: Synapse expose Prometheus metrics tai /_synapse/metrics. Grafana dashboard "Synapse" co san. Theo doi user count, room count, federation peer va response time.
Voi cau hinh nay, Matrix Synapse cua ban tren AnubizHost VPS Iceland tro thanh nen tang chat cong dong an toan, phi tap trung va co bao mat phap ly - mot lua chon vuot xa Discord va Slack ve quyen rieng tu va chu quyen du lieu.
Related Services
Why Anubiz Host
Ready to get started?
Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.