Skip to content
Bobby edited this page Jul 30, 2022 · 10 revisions

Here is gist of what you will need in your NGINX config file:

upstream lolisafe {
    # Change this port if required.
    server 127.0.0.1:9999;
}

server {
    # ...
    location / {
        # Max upload size enforced on NGINX layer. Set accordingly.
        client_max_body_size 10240m;

        proxy_pass http://localhost;
        proxy_redirect off;
        proxy_http_version 1.1;

        # Disable from-and-to buffering (redundant for lolisafe).
        proxy_buffering off;
        proxy_request_buffering off;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        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_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-NginX-Proxy true;

        # Increasing these may help with clients with very slow upload speeds.
        proxy_connect_timeout 60s;
        proxy_send_timeout 60s;
        proxy_read_timeout 60s;
        send_timeout 60s;
    }
    # ...
}

That is just the bare bones of what you will need if you choose to serve uploaded files with lolisafe (i.e. having serveFilesWithNode option enabled in lolisafe config).

You will need more elaborate configs if you want to do things such as serving uploaded files directly with NGINX and whatnot.

Clone this wiki locally