# Nginx configuration for Ditto. # # Edit this file to change occurences of "example.com" to your own domain. upstream ditto { server 127.0.0.1:4036; } server { listen 80; listen [::]:80; location /.well-known/acme-challenge/ { allow all; } location / { return 301 https://$host$request_uri; } } server { server_name example.com; keepalive_timeout 70; sendfile on; client_max_body_size 100m; ignore_invalid_headers off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; root /opt/ditto/public; location @spa { try_files /index.html /dev/null; } location @frontend { try_files $uri @ditto-static; } location @ditto-static { root /opt/ditto/static; try_files $uri @spa; } location /packs { add_header Cache-Control "public, max-age=31536000, immutable"; add_header Strict-Transport-Security "max-age=31536000" always; root /opt/ditto/public; } location ~ ^/(instance|sw\.js$|sw\.js\.map$) { root /opt/ditto/public; try_files $uri =404; } location = /favicon.ico { root /opt/ditto/static; try_files $uri =404; } location ~ ^/(api|relay|oauth|manifest.json|nodeinfo|.well-known/(nodeinfo|nostr.json)) { proxy_pass http://ditto; } location / { try_files /dev/null @frontend; } }