# witryna.conf — Nginx reverse proxy configuration for Witryna # # Two server blocks: # 1. Public site — serves the built static assets # 2. Webhook endpoint — proxies deploy triggers to Witryna # # TLS is not configured here — use certbot or similar to add certificates: # sudo certbot --nginx -d my-site.example.com -d witryna.example.com # Rate limiting: 10 requests per minute per source IP for webhook endpoints. # Place this directive at the http {} level (outside server blocks) or in a # separate file included from nginx.conf. limit_req_zone $binary_remote_addr zone=witryna_webhooks:10m rate=10r/m; # Public site — serves your built static files server { listen 80; server_name my-site.example.com; root /var/lib/witryna/builds/my-site/current; index index.html; location / { try_files $uri $uri/ =404; } # Security headers add_header X-Frame-Options "DENY" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; } # Webhook endpoint — reverse proxy to Witryna server { listen 80; server_name witryna.example.com; # Only allow POST requests location / { limit_except POST { deny all; } limit_req zone=witryna_webhooks burst=5 nodelay; limit_req_status 429; proxy_pass http://127.0.0.1:8080; 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; } # Security headers add_header X-Content-Type-Options "nosniff" always; }