Skip to content

Instantly share code, notes, and snippets.

@joenas
Last active May 14, 2021 16:53
Show Gist options
  • Save joenas/194af2f7c2ccf2b04b0a8472974c2447 to your computer and use it in GitHub Desktop.
Save joenas/194af2f7c2ccf2b04b0a8472974c2447 to your computer and use it in GitHub Desktop.
Nginx example conf for Synapse matrix Homeserver
# vim: syntax=nginx
server {
listen 80;
server_name example.com www.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
# If you don't wanna serve a site, comment this out
root /var/www/example.com;
index index.html index.htm;
# See https://github.com/matrix-org/synapse/blob/develop/docs/reverse_proxy.md#nginx for latest examples
location ~* ^(\/_matrix|\/_synapse\/client) {
proxy_pass http://localhost:8008;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
# Nginx by default only allows file uploads up to 1M in size
# Increase client_max_body_size to match max_upload_size defined in homeserver.yaml
client_max_body_size 50M;
}
}
@Adrien-Luxey
Copy link

Invalid from the looks of it, refer to https://github.com/matrix-org/synapse/blob/develop/docs/reverse_proxy.md#nginx instead.
What bugs me is your location, it should be location ~* ^(\/_matrix|\/_synapse\/client) according to the docs (and my experience).

@AnonymousWebHacker
Copy link

Invalid from the looks of it, refer to https://github.com/matrix-org/synapse/blob/develop/docs/reverse_proxy.md#nginx instead.
What bugs me is your location, it should be location ~* ^(\/_matrix|\/_synapse\/client) according to the docs (and my experience).

yes, is true that

@joenas
Copy link
Author

joenas commented May 7, 2021

Indeed Adrien, it looks like they updated that some time ago. Still working just fine for me though 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment