Skip to content
Bobby edited this page Aug 22, 2022 · 10 revisions

Here is the 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://lolisafe;
        # proxy_pass http://127.0.0.1:9999; # You can also do it this way directly.
        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;

        # Configuring 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 via 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.

It will then also open up the possibility of having files be served on a different domain from the lolisafe homepage's domain, among other things.

Clone this wiki locally