Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

3.1 KB
Raw Blame
# SYNC-IN NGINX VHOST

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

upstream sync_in_server {
    server sync_in:8080;
    keepalive 32;
}

server {
    listen 80;
    # listen 443 ssl;
    # http2 on;
    # server_name  domain.com www.domain.com;
    # ssl_certificate      /etc/ssl/certs/fullchain.pem;
    # ssl_certificate_key  /etc/ssl/certs/privkey.pem;
    # ssl_protocols TLSv1.2 TLSv1.3;
    # ssl_session_cache shared:SSL:10m;
    # ssl_session_timeout 1h;
    # ssl_prefer_server_ciphers on;
    # ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305';
    # ssl_ecdh_curve X25519:prime256v1;

    # General settings
    charset UTF-8;
    server_tokens off;
    access_log off;
    include mime.types;

    # Optimized file sending
    sendfile on;
    tcp_nodelay on;
    tcp_nopush on;

    # Buffering for requests proxied to Node
    proxy_http_version 1.1;
    chunked_transfer_encoding on;
    proxy_set_header Host $http_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 $http_host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_cache_bypass $http_upgrade;
    proxy_redirect off;

    # Proxy buffering settings
    proxy_buffering off; # nginx -> node
    proxy_buffers 8 512k;
    proxy_buffer_size 512k; # node highWaterMark

    # Generous timeouts for long transfers or ws
    proxy_read_timeout 3600s;
    proxy_send_timeout 3600s;
    keepalive_timeout  180  90s;

    # Clients settings
    proxy_request_buffering off; # client -> nginx
    large_client_header_buffers 4 16k;
    client_max_body_size 0;
    client_body_buffer_size 25M;

    location / {
        proxy_pass http://sync_in_server;
    }

    location ~* .(ico|jpg|png|gif|jpeg|swf|woff|svg)$ {
        # nginx always use the most accurate rule in its internal routing policies
        proxy_pass http://sync_in_server;
        gzip_static on;
        gzip_comp_level 5;
        expires 1d;
        add_header Cache-Control public;
    }

    # NOTE: This is only needed when the Collabora Online Docker container is running locally
    #       and you are not using an external URL.
    # Uncomment the line below to enable it:
    # include collabora.conf;

    # NOTE: This is only needed when the OnlyOffice Docker container is running locally
    #       and you are not using an external URL.
    # Uncomment the line below to enable it:
    # include onlyoffice.conf;

    # NOTE: This is only needed when the Euro-Office Docker container is running locally
    #       and you are not using an external URL.
    # Uncomment the line below to enable it:
    # include eurooffice.conf;

    # NOTE: This is only needed when the draw.io Docker container is running locally
    #       and you are not using an external URL.
    # Uncomment the line below to enable it:
    # include drawio.conf;
}