41 lines
1.4 KiB
Ruby
41 lines
1.4 KiB
Ruby
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name matrix.buryans.ru;
|
|
location /.well-known/acme-challenge/ { root /var/www/certbot; }
|
|
location / { return 301 https://$host$request_uri; }
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
http2 on;
|
|
server_name matrix.buryans.ru;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/matrix.buryans.ru/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/matrix.buryans.ru/privkey.pem;
|
|
|
|
# Правильные .well-known ответы (перехватываем до proxy)
|
|
location = /.well-known/matrix/client {
|
|
default_type application/json;
|
|
add_header Access-Control-Allow-Origin "*";
|
|
return 200 "{\"m.homeserver\": {\"base_url\": \"https://matrix.buryans.ru\"}, \"m.identity_server\": {\"base_url\": \"https://vector.im\"}}";
|
|
}
|
|
|
|
location = /.well-known/matrix/server {
|
|
default_type application/json;
|
|
add_header Access-Control-Allow-Origin "*";
|
|
return 200 "{\"m.server\": \"matrix.buryans.ru:443\"}";
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://192.168.1.155:8008;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
}
|