server {
	listen 443 ssl;
	listen [::]:443 ssl;

	# For the federation port
	listen 8448 ssl;
	listen [::]:8448 ssl;

	ssl_certificate /etc/letsencrypt/live/vm02199.example.com/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/vm02199.example.com/privkey.pem;
	include /etc/letsencrypt/options-ssl-nginx.conf;
	ssl_dhparam /etc/ssl/dhparams.pem;

	server_name vm02199.example.com;

	location ~ ^/_synapse/admin {
		allow 127.0.0.1;
		allow ::1;
		allow 111.222.111.222;
		allow dead:beef::/64;
		deny all;

		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;
		client_max_body_size 50M;
		proxy_http_version 1.1;
	}

	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;
		client_max_body_size 50M;
		proxy_http_version 1.1;
	}

	access_log /var/log/nginx/vm02199-access.log;
	error_log /var/log/nginx/vm02199-error.log;

}
