[新服务] 支持端到端加密!打造自己专属的去中心化即时聊天室Matrix(通用协议) & Element(客户端)
date
Nov 10, 2023
slug
newservice-chat-end2end-matrix-element
status
Published
summary
新服务-加密通信-MatrixElement
tags
service
type
Post

Summary
- 官网: ‣
步骤
set up with docker compose
export DOCKER_PROJ=matrix
export DOCKER_PROJ_DOMAIN=matrix.xxxxxx.org
mkdir -p /data/$DOCKER_PROJ/data; cd /data/$DOCKER_PROJ
sudo docker run -it --rm \
-v /data/matrix/data:/data \
-e SYNAPSE_SERVER_NAME=$DOCKER_PROJ_DOMAIN \
-e SYNAPSE_REPORT_STATS=yes \
matrixdotorg/synapse:latest generate
cd /data/matrix/data
vim homeserver.yaml
#append at the end
"
enable_registration: true
enable_registration_without_verification: true
"
cd ..
cat > docker-compose.yml <<EOF
version: "3.3"
services:
synapse:
image: "matrixdotorg/synapse:latest"
container_name: "matrix_synapse"
restart: unless-stopped
#ports:
# - 8008:8008
volumes:
- "./data:/data" # it will look at the current directory where you save the file and look for the data folder inside
environment:
VIRTUAL_HOST: "matrix.xxxxxx.org"
VIRTUAL_PORT: 8008
LETSENCRYPT_HOST: "matrix.xxxxxx.org"
SYNAPSE_SERVER_NAME: "matrix.xxxxxx.org"
SYNAPSE_REPORT_STATS: "yes"
element-web:
#ports:
# - '8009:80'
#volumes:
# - '/etc/element-web/config.json:/app/config.json'
image: vectorim/element-web
container_name: "matrix_element-web"
restart: unless-stopped
networks:
default:
name: npm_nginx_proxy_manager-network
external: true
EOF
docker-compose down; docker-compose up -d; sleep 1s; docker-compose logs -f
# update
docker-compose down
docker image prune
docker-compose pull
docker-compose up -d; sleep 1s; docker-compose logs -f
Nginx Proxy Manager NPM
# npm reverse proxy
location / {
proxy_pass http://matrix_element-web:80/; # 注意改成你实际使用的端口
rewrite ^/(.*)$ /$1 break;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade-Insecure-Requests 1;
proxy_set_header X-Forwarded-Proto https;
}


客户端注册 - 改服务器设置


验证

