Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.3 kB
2
Indexable
Never
server {
    client_max_body_size 999M;

    if ($host = api.stg.klouser.app) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    #Redirect HTTP to HTTPS
    listen 80;
    server_name api.stg.klouser.app;
    return 301 https://$host$request_uri;
}

server {
    client_max_body_size 999M;

    #Listen HTTPS
    listen 443 ssl; # managed by Certbot
    server_name api.stg.klouser.app;

    ssl_certificate /etc/letsencrypt/live/api.stg.klouser.app/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/api.stg.klouser.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

    location / {
        proxy_pass http://localhost:1337;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $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_set_header Host $http_host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass_request_headers on;
    }
}