尝试使用 Nginx SSL 反向代理配置 Matrix Synapse。这是我的配置
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;
}
}
homeserver.yaml 中的配置(其他配置均未更改)
- port: 8008
tls: false
bind_addresses: ['::','0.0.0.0']
type: http
x_forwarded: true
当打开页面时https://域名.name.com出现 404 not found。打开时http://192.168.0.10:8008/_matrix/作品。
这是 Nginx 还是 Matrix 配置文件的问题?
更新:在我安装了最新版本的 Matrix 后,位置 /_matrix 工作正常。nginx 代理的正确路径应该是 /_matrix,如手册中所述。这是检查 ssl 的方法https://域名,名称.com/_matrix/client/versions
答案1
Nginx 反向代理突触看起来应该是这样的:
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