server { listen 80; server_name greasysprocket.com www.greasysprocket.com; root /var/www/greasysprocket.com; index index.html; # Static files location / { try_files $uri $uri/index.html $uri.html =404; } # Feedback POST → Go binary (separate location for POST only) location = /feedback { # POST goes to Go backend limit_except GET POST { deny all; } # If POST, proxy to Go service if ($request_method = POST) { rewrite ^ /feedback_api last; } # GET serves the feedback page try_files $uri $uri/index.html /feedback/index.html; } # Internal location for POST proxy location = /feedback_api { internal; proxy_pass http://127.0.0.1:8080/feedback; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Content-Type $http_content_type; } # Stats endpoint location /feedback/stats { proxy_pass http://127.0.0.1:8080/feedback/stats; proxy_set_header Host $host; } # Gzip gzip on; gzip_types text/plain text/css application/json application/javascript text/xml; gzip_min_length 1000; # Cache static assets location ~* \.(jpg|jpeg|png|gif|svg|ico|woff2?)$ { expires 30d; add_header Cache-Control "public, immutable"; } location ~* \.(css|js)$ { expires 7d; add_header Cache-Control "public"; } }