server {
        server_name mafia.game.igarson.app;
        access_log /var/log/nginx/ig/access.game.mafia.log;
        error_log /var/log/nginx/ig/error.game.mafia.log;

        location / {
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header    X-Real-IP $remote_addr;
            proxy_pass http://127.0.0.1:6003;
            proxy_read_timeout 90;
            proxy_redirect off;

        }
    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/demo.igarson.app/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/demo.igarson.app/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 {
        server_name api.mafia.game.igarson.app;
        access_log /var/log/nginx/ig/access.game.api.mafia.log;
        error_log /var/log/nginx/ig/error.game.api.mafia.log;
        client_max_body_size 10M;

        location / {
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header    X-Real-IP $remote_addr;
            proxy_pass http://127.0.0.1:6023;
            proxy_read_timeout 90;
            proxy_redirect off;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";

        }
    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/demo.igarson.app/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/demo.igarson.app/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 {
        server_name 2048.game.igarson.app;
        access_log /var/log/nginx/ig/access.game.2048.log;
        

        location / {
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header    X-Real-IP $remote_addr;
            proxy_pass http://127.0.0.1:6001;
            proxy_read_timeout 90;
            proxy_redirect off;

        }
    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/demo.igarson.app/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/demo.igarson.app/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{
        server_name sudoku.game.igarson.app;
        access_log /var/log/nginx/ig/access.game.sudoku.log;
        location / {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_pass http://127.0.0.1:6002;
            proxy_read_timeout 90;
            proxy_redirect off;
        }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/sudoku.game.igarson.app/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/sudoku.game.igarson.app/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{
        server_name quiz.game.igarson.app;
        access_log /var/log/nginx/ig/access.game.quiz.log;
        error_log /var/log/nginx/ig/error.game.quiz.log;
        location / {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_pass http://127.0.0.1:8097;
            proxy_read_timeout 90;
        }


    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/demo.igarson.app/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/demo.igarson.app/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{
        server_name api.quiz.game.igarson.app;
        access_log /var/log/nginx/ig/access.game.api.quiz.log;
        error_log /var/log/nginx/ig/error.game.api.quiz.log;

        location / {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_pass http://127.0.0.1:8096;
            proxy_read_timeout 90;
        }
    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/demo.igarson.app/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/demo.igarson.app/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


}



# redirects 


server{
    if ($host = mafia.game.igarson.app) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    server_name mafia.game.igarson.app;
    listen 80;
    return 404; # managed by Certbot
}

server{
    if ($host = 2048.game.igarson.app) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    server_name 2048.game.igarson.app;
    listen 80;
    return 404; # managed by Certbot
}
server{
    if ($host = api.mafia.game.igarson.app) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    server_name api.mafia.game.igarson.app;
    listen 80;
    return 404; # managed by Certbot
}
server{
    if ($host = quiz.game.igarson.app) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    server_name quiz.game.igarson.app;
    listen 80;
    return 404; # managed by Certbot
}
server{
    if ($host = api.quiz.game.igarson.app) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    server_name api.quiz.game.igarson.app;
    listen 80;
    return 404; # managed by Certbot
}





server{
    if ($host = sudoku.game.igarson.app) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        server_name sudoku.game.igarson.app;
    listen 80;
    return 404; # managed by Certbot


}
