{{#PORTAL_DOMAIN}}
server {
	server_name {{PORTAL_DOMAIN}}; # example: siasky.net
	
	include /etc/nginx/conf.d/server/server.http;
}

server {
	server_name {{PORTAL_DOMAIN}}; # example: siasky.net

	ssl_certificate     /data/caddy/caddy/certificates/acme-v02.api.letsencrypt.org-directory/{{PORTAL_DOMAIN}}/{{PORTAL_DOMAIN}}.crt;
	ssl_certificate_key	/data/caddy/caddy/certificates/acme-v02.api.letsencrypt.org-directory/{{PORTAL_DOMAIN}}/{{PORTAL_DOMAIN}}.key;

	include /etc/nginx/conf.d/server/server.api;
}
{{/PORTAL_DOMAIN}}

{{#SERVER_DOMAIN}}
server {
	server_name {{SERVER_DOMAIN}}; # example: eu-ger-1.siasky.net

	include /etc/nginx/conf.d/server/server.http;

	set_by_lua_block $server_alias { return string.match("{{SERVER_DOMAIN}}", "^([^.]+)") }
}

server {
	server_name {{SERVER_DOMAIN}}; # example: eu-ger-1.siasky.net

	ssl_certificate     /data/caddy/caddy/certificates/acme-v02.api.letsencrypt.org-directory/{{SERVER_DOMAIN}}/{{SERVER_DOMAIN}}.crt;
	ssl_certificate_key	/data/caddy/caddy/certificates/acme-v02.api.letsencrypt.org-directory/{{SERVER_DOMAIN}}/{{SERVER_DOMAIN}}.key;

	include /etc/nginx/conf.d/server/server.api;
	
	set_by_lua_block $server_alias { return string.match("{{SERVER_DOMAIN}}", "^([^.]+)") }
}
{{/SERVER_DOMAIN}}