server {

	root /var/www/html;

	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;

	server_name matrix.theribbles.org;

        access_log /var/log/nginx/matrix.theribbles.org-access.log;

	error_log /var/log/nginx/matrix.theribbles.org-error.log debug;


	location ~ {
		# note: do not add a path (even a single /) after the port in `proxy_pass`,
		# otherwise nginx will canonicalise the URI and cause signature verification
		# errors.
		proxy_pass http://localhost:10180;
		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;
	}


	listen 443 ssl http2; # manually changed, but added by Certbot

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

	ssl_certificate /etc/letsencrypt/live/theribbles.org/fullchain.pem; # managed by Certbot
	ssl_certificate_key /etc/letsencrypt/live/theribbles.org/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

}
server {
	if ($host = matrix.theribbles.org) {
		return 301 https://$host$request_uri;
	} # managed by Certbot


	listen 80;
	listen [::]:80;

	server_name matrix.theribbles.org;
	return 404; # managed by Certbot
}