Nginx Reverse Proxy and Seafile Server

Hello there,

I’ve seen many posts about how to setup nginx as a reverse proxy for seafile containers, but none on how to set ip up for a standard installation.

I’ve got a server which is exposed to the internet and that redirect some requests to another server in the lan.


The seafile server also has an nginx, listening on port 443. So basically what I want to achieve is to make the exposed server with nginx listening on port 443 to proxy all requests to the seafile server which listen to 443 and proxies to the internal seafile services.

How to configure the reverse proxy to do that?

If I understood correctly there shouldn’t be a difference between proxying to a container that is running nginx and proxying to nginx that is serving Seafile.

server {
    listen            80;
    listen            [::]:80;
    server_name       exposed.server;

    # Permanently redirect all requests to HTTPS
    return 301 https://$server_name$request_uri;

server {
    listen            443 http2 ssl;
    listen            [::]:443 http2 ssl;
    server_name       exposed.server;

    ssl_certificate        /etc/letsencrypt/live/exposed.server/fullchain.pem;
    ssl_certificate_key    /etc/letsencrypt/live/exposed.server/privkey.pem;

    location / {
        proxy_pass          https://seafile.server;
        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-Host $server_name;
        proxy_set_header    X-Forwarded-Proto https;
        proxy_read_timeout  1200s;

        # used for view/edit office file via Office Online Server
        client_max_body_size    0;

The above configuration should work but I haven’t used nginx in years so please adapt and test yourself.

Thank you! It was easy!

I was using http instead of https here:

        proxy_pass          https://seafile.server;


1 Like