upstream gravitlauncher {
    server 127.0.0.1:9274;
}
map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}
server {
    server_name launcher.smpworld.ru;
    keepalive_requests 100000;
    charset utf-8;
    #access_log  /var/log/nginx/launcher.smpworld.ru.access.log;
    #error_log  /var/log/nginx/launcher.smpworld.ru.error.log notice;
    
    root /home/launcher/updates;
    
    location / {
    }
    location /api {
        proxy_pass http://gravitlauncher;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    location /webapi/ {
        proxy_pass http://127.0.0.1:9274/webapi/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
 
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/launcher.smpworld.ru/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/launcher.smpworld.ru/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 = launcher.smpworld.ru) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name launcher.smpworld.ru;
    return 404; # managed by Certbot


}
