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

	server_name z.libertus.eu autodiscover.libertus.eu;
	access_log /var/log/nginx/z.libertus.eu.access.log combined;
	access_log syslog:server=unix:/dev/log combined;
	error_log /var/log/nginx/z.libertus.eu.error.log;
	error_log syslog:server=unix:/dev/log;

	ssl_certificate /etc/x509/z.libertus.eu/fullchain.cer;
	ssl_certificate_key /etc/x509/z.libertus.eu/z.libertus.eu.key;

	root /usr/share/z-push;
	index index.php;

	client_max_body_size 20M;
	client_body_buffer_size 128k;
	keepalive_timeout 90;
	proxy_read_timeout 1200;
	sendfile on;

	location / {
		try_files $uri $uri/ index.php;
	}

	location /Microsoft-Server-ActiveSync {
		rewrite ^(.*)$ /index.php last;
	}

	location ~* ^/autodiscover/autodiscover\.xml$ {
		rewrite ^(.*)$ /autodiscover/autodiscover.php last;
	}

	location ~* \.php$ {
		include fastcgi_params;
		fastcgi_pass unix:/var/run/php/php{{ php_version }}-fpm.sock;
		fastcgi_read_timeout 1200;
	}
}
