# 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 $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-Proto $scheme; root /opt/ditto/public; 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 /metrics { allow 127.0.0.1; deny all; proxy_pass http://ditto; } location / { proxy_pass http://ditto; } }