client_max_body_size 20M;

upstream backend {
    server {{ .Env.URL_BACKEND }};
}

server {
    index index.html;
    root /var/www/public/;

    {{ if .Env.FRONTEND_SERVER_NAME }}
    server_name {{ .Env.FRONTEND_SERVER_NAME }};
    {{else}}
    server_name _;
    {{end}}

    include sites.d/frontend.conf;
    include include.d/letsencrypt.conf;
}

{{if .Env.BACKEND_SERVER_NAME}}
server {
    server_name {{ .Env.BACKEND_SERVER_NAME }};
    include sites.d/backend.conf;
    include include.d/letsencrypt.conf;
}
{{end}}