server {
    server_name turnosxpress.com.ar www.turnosxpress.com.ar;

    root /var/www/turnosxpress.com.ar;

    location ^~ /.well-known/acme-challenge/ {
        root /var/www/certbot;
    }

    #Sirvo el favicon desde la pagina de working
    location = /favicon.ico {
        root /var/www/working-web;
        access_log off;
        log_not_found off;
    }

    # Sitio web de Produccion
    location / {
        proxy_pass http://localhost:3021;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        client_max_body_size 5M;
        proxy_cache_bypass $http_upgrade;
    }

    # Sitio web de Mantenimiento
    #location / {
    #    root /var/www/working-web;
    #    index index.html;
    #    try_files $uri $uri/ /index.html;
    #    #Desactivar caché en los navegadores
    #    add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
    #    add_header Pragma "no-cache" always;
    #    add_header Expires 0 always;
    #}


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/turnosxpress.com.ar/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/turnosxpress.com.ar/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 = www.turnosxpress.com.ar) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = turnosxpress.com.ar) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name turnosxpress.com.ar www.turnosxpress.com.ar;
    return 404; # managed by Certbot




}
