I recently snagged a bargain on the domain ruoo.de, with an annual renewal cost of just under 2 euros. I've been planning to add a "Contact the Webmaster" feature to a couple of sites, but I found traditional email and Telegram options less than ideal. That led me to consider Matrix, making this domain perfect for setting up a server for personal use.

Setting Up Matrix on Synapse : Synapse is the server implementation for Matrix. I've opted for a client-server separation approach, with the server preferably running on a robust SSD-equipped machine due to its extensive disk space requirements.

Initial Setup with Docker: First, you need to install Docker on the server (details on installation are not covered here as they are readily available online).

Next, create a working directory.

cd /
mkdir -p /var/matrix-synapse-data/

Run the server initially to generate a default configuration file.

docker run -it --rm -v /var/matrix-synapse-data/:/data/ -e SYNAPSE_SERVER_NAME=ruoo.de -e SYNAPSE_REPORT_STATS=no matrixdotorg/synapse:latest generate
docker run -d --name synapse -v /var/matrix-synapse-data/:/data/ -p 8008:8008 -p 8009:8009 -p 8448:8448 matrixdotorg/synapse:latest

After this, create an administrative user for easier management going forward.

docker exec -it synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml -a -u 你想要的用户名 -p 你想要的密码

Now, you can edit the server configuration file located at /var/matrix-synapse-data/homeserver.yaml. The most critical settings are the database and registration configurations. For simplicity, I used SQLite3 as the database, but you can find configurations using PostgreSQL online. Here is an example of my server configuration for your reference.homeserver.yaml .

erver_name: "ruoo.de"
pid_file: /data/homeserver.pid
listeners:
  - port: 8008
    tls: false
    type: http
    x_forwarded: true
    resources:
      - names: [client, federation]
        compress: false
database:
  name: sqlite3
  args:
    database: /data/homeserver.db
log_config: "/data/ruoo.de.log.config"
media_store_path: /data/media_store
registration_shared_secret:"xxxxxxxxxxxxxxx"
report_stats: false
macaroon_secret_key: "xxxxxxxxxxxxxxxx"
form_secret: "xxxxxxxxx"
signing_key_path: "/data/ruoo.de.signing.key"
trusted_key_servers:
  - server_name: "matrix.org"

presence:
  enabled: true

email:
  smtp_host: xxxxxxxxxxxxx #你的smtp服务器
  smtp_port: 465 #一般是465
  smtp_user: "xxxxxxxxxxx" #自行填写
  smtp_pass: "xxxxxxxxxxxxx" #自行填写
  force_tls: true
  require_transport_security: true
  enable_tls: true
  notif_from: "xxxxxxxxxxxxxxx" #修改为你想要设置的发件人名称
  enable_notifs: true
  notif_for_new_users: false
  client_base_url: "https://ruoo.de" #修改为你的客户端域名
  validation_token_lifetime: 15m
  invite_client_location: "https://ruoo.de" #修改为你的客户端域名
suppress_key_server_warning: true

database:
  name: sqlite3  #这里为了方便起见,选用sqlite3作为数据库。你也可以使用PostgreSQL数据库,参考官方文档自行配置
  args:
    database: /data/homeserver.db

enable_registration: true
enable_registration_without_verification: true

Restart and Verify : After saving your configurations, restart the server.

docker ps
docker restart synapse

If you access your server using the IP or domain followed by port 8008 and see a specific page, it indicates everything is set up correctly.

Reverse Proxy Setup : The backend configuration is now complete. Next, set up a reverse proxy using Nginx or Apache. If you are using a control panel like Baota or AMH, you can simply use the built-in reverse proxy feature to target the 127.0.0.1:8008 port.

Client Setup : At this point, any Matrix client can set the main server to ruoo.de for successful registration and use. Out of curiosity and to compare the speeds of different servers, I set up two different web clients, which you can try:

Elements (Cloudflare proxy): https://room.ruoo.de

Elements(Cloudflare代理): https://room.ruoo.de

Cinny (Hong Kong server proxy): https://chat.ruoo.de https://chat.ruoo.de

I hope to write more about using Matrix at a later time. Meanwhile, feel free to register and use the web portals I've set up.

Leave a comment

Your email address will not be published. Required fields are marked *

en_USEN