Synapse (Matrix) via dynDNS

I tried to install Synapse on my Raspi yesterday. The installation itself went through without any problems. But I had difficulties to reach it via my DynDNS (spdns.de). I have released the ports 8008 and 8448 on my Fritzbox. Does anyone have an idea where the error is?

In this message you announce a separate post about Synapse for the blog. Maybe this will help me when it is published?

Thanks,
Schimy

1 Like

Hi,

did you activate TLS configuration inside Synapse? Means you configured SSL certificate and activated HTTPS port?

Hi Joulinar,
thx for your repliy

no, not knowingly. how do i have to do that?

yes, SSL via let’s encrypt and port 443 is active … for the whole pi

ok in this case it might be easier to reuse the existing web server as revers proxy. What web server you are running? And is it used for other web apps already?

  • Nginx as web server
  • Nextcloud in a subdir
  • let’s encrypt certificate
    everything installed via dietpi-software script
    dyndns: spdns.de installed manually

that’s pretty perfect as we could easily enable Nginx to work as revers proxy for Matrix. Do following

nano /etc/nginx/sites-dietpi/matrix.conf

add following inside

    location /_matrix {
      proxy_pass http://127.0.0.1:8008;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header X-Forwarded-Proto $scheme;
      client_max_body_size 50M;
    }

    location /.well-known/matrix/server {
      return 200 '{"m.server": "your.ddns.spdns.de:443"}';
      add_header Content-Type application/json;
    }

    location /.well-known/matrix/client {
      return 200 '{"m.homeserver": {"base_url": "https://your.ddns.spdns.de"}}';
      add_header Content-Type application/json;
      add_header "Access-Control-Allow-Origin" *;
    }

save and exit the file. Restart Nginx now

systemctl restart nginx.service

Usually you should be able to reach Matrix via apps like Elemet. Custom URL would be simply your.ddns.spdns.de

This is based on this blog post https://decatec.de/home-server/matrix-synapse-auf-ubuntu-server-20-04-lts-mit-nginx-postgresql-und-lets-encrypt/#Virtueller_Host_fuer_Matrix_Synapse

Hi Joulinar

this works perfectly!!!

thx you very much for your fast and uncomplicated help :smiley:

perfect :slight_smile:

1 Like