toolkit icon indicating copy to clipboard operation
toolkit copied to clipboard

No support for external nginx instance

Open spaceboots23 opened this issue 1 year ago • 2 comments

It's great that there is a well built mechanism for running a stand-alone instance of sharelatex, but for those wanting to spin it up in a docker container and use an existing nginx reverse-proxy setup (such as one would want to do on a home server), this is a real pain in the neck. What should be a 5 minute job is basically impossible.

spaceboots23 avatar Sep 06 '24 12:09 spaceboots23

It's not impossible and I was basically able to set it up in 5 minutes. Just use a setup similar to this and make sure the ports match:

server {
    server_name overleaf.example.com;
    location / {
        proxy_pass https://localhost:444/;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 10m;
        proxy_send_timeout 10m;
    }

    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";

    server_tokens off;

    client_max_body_size 50M;

    # I am using Certbot, so it automatically added these.
    # You don't need to use it - but it works quite well for me.
    listen 443 ssl; # managed by Certbot
    ssl_certificate /path/to/fullchain.pem; # managed by Certbot
    ssl_certificate_key /path/to/privkey.pem; # managed by Certbot
    include /path/to/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /path/to/ssl-dhparams.pem; # managed by Certbot
}

ThexXTURBOXx avatar Sep 10 '24 07:09 ThexXTURBOXx

Impossible, you say? I have a working Overleaf setup going through an external nginx reverse proxy. Here’s how:

overleaf.rc:

OVERLEAF_PORT=8888

variables.env:

OVERLEAF_BEHIND_PROXY=true
OVERLEAF_SITE_URL=https://overleaf.example.com

FifoF avatar Oct 11 '24 17:10 FifoF