overleaf / toolkit

GNU Affero General Public License v3.0
562 stars 136 forks source link

No support for external nginx instance #290

Open spaceboots23 opened 1 week ago

spaceboots23 commented 1 week ago

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.

ThexXTURBOXx commented 1 week ago

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
}