events {}

http {

    upstream nise-nginx {
        server nise-nginx:80;
    }

    # Redirect HTTP to HTTPS
    server {
        listen 80;
        server_name nise.stedos.dev;
        return 301 https://$host$request_uri;
    }

    server {
        listen 443 ssl;
        server_name nise.stedos.dev;

        ssl_certificate /etc/ssl/certs/nisemoe/certificate.pem;
        ssl_certificate_key /etc/ssl/certs/nisemoe/private.key;

        location / {
            # For git.nise.moe
            client_max_body_size 512M;

            proxy_pass http://nise-nginx;
            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;

            # Websockets
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }

}