我刚刚在我的 VPS 上安装了 Synapse,现在尝试设置 nginx 反向代理。但是,它显示 nginx 默认页面。我在https://discourse.xinghaizhandui.com运行正常。我检查了配置文件,但没有发现反向代理不工作的原因https://matrix.xinghaizhandui.com。有什么想法吗?如果我使用 SSH 隧道访问 http://localhost:8008,则会加载正确的页面。附件是 matrix.conf。
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
listen 8448 ssl http2 default_server;
listen [::]:8448 ssl http2 default_server;
server_name matrix.xinghaizhandui.com;
location ~ ^(/_matrix|/_synapse/client) {
proxy_pass http://localhost:8008;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50M;
}
ssl_certificate /etc/letsencrypt/live/xinghaizhandui.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/xinghaizhandui.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
答案1
尝试这个
...
location / {
proxy_pass http://localhost:8008;
...