{app_upstream}

upstream openviduserver {
    server localhost:5443;
}

server {
    listen {http_port};
    listen [::]:{http_port};
    server_name {domain_name};
    
    # Redirect to https
    location / {
        rewrite ^(.*) https://{domain_name}:{https_port}$1 permanent;
    }    

    # letsencrypt
    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
    }

    {nginx_status}
}

{redirect_www}

{redirect_www_ssl}

server {
    listen {https_port} ssl;
    listen [::]:{https_port} ssl;
    server_name {domain_name};

    {ssl_config}

    {proxy_config}

    {app_config}

    ########################
    # OpenVidu Locations   #
    ########################
    {common_api_ce}

    {deprecated_api_ce}

    {new_api_ce}

    #################################
    # LetsEncrypt                   #
    #################################
    location /.well-known/acme-challenge {
        root /var/www/certbot;
        try_files $uri $uri/ =404;
    }
}
