1

Trying to configure Matrix synapse with Nginx ssl reverse proxy. Here my config

server {
listen   443;
server_name domain.name.com;



ssl    on;
ssl_certificate         SSL_CERT;
ssl_certificate_key     SSL_KEY;
ssl_trusted_certificate SSL_CHAIN_CERT;


location /_matrix  {

     proxy_pass              http://127.0.0.1:8008;
     proxy_set_header        X-Forwarded-For $remote_addr;
 }

}

Configuration in homeserver.yaml (no other configuration was changed)

- port: 8008
tls: false
bind_addresses: ['::','0.0.0.0']
type: http

x_forwarded: true

When opening page at https://domain.name.com get 404 not found. When opening http://192.168.0.10:8008/_matrix/ works.

Is it problem of Nginx or Matrix config file?

UPDATE: After I've installed the latest version of Matrix, location /_matrix work fine. Right path for nginx proxy should be /_matrix as in the manual. This is how to check ssl https://domain,name.com/_matrix/client/versions

ptman
  • 27,124
  • 2
  • 26
  • 45
Roman Koval
  • 101
  • 7
  • have you tried underscores_in_headers on; in the http section? – c4f4t0r Aug 21 '18 at 12:17
  • Does your "UPDATE" mean that you solved the problem? It sounds like you have fixed it. If so, you should post an answer. Answers do not belong in the question, they will not be noticed there and will confuse people. – Michael Hampton Aug 30 '18 at 10:50

1 Answers1

0

Nginx reverse proxying synapse should look something like this:

    server {
        listen 443 ssl;
        listen [::]:443 ssl;
        server_name matrix.example.com;

        location /_matrix {
            proxy_pass http://localhost:8008;
            proxy_set_header X-Forwarded-For $remote_addr;
        }
    }

    server {
        listen 8448 ssl default_server;
        listen [::]:8448 ssl default_server;
        server_name example.com;

        location / {
            proxy_pass http://localhost:8008;
            proxy_set_header X-Forwarded-For $remote_addr;
        }
    }

https://github.com/matrix-org/synapse/blob/master/docs/reverse_proxy.md

ptman
  • 27,124
  • 2
  • 26
  • 45