PortGate

Blueprints · Reverse Proxy & SSL

Beginner 5 min · Nginx

Nginx client body limit

Stages a client_max_body_size so anonymous clients cannot upload huge bodies by default.

Baked-in protections

Step 1 · conf

Body limit

/root/portgate-blueprints/client-body.conf

Put this in the server block. Override it on the one location that accepts uploads.

client_max_body_size 8m;

Step 2 · bash

Read-only check

/root/portgate-blueprints/body-limit-check.sh

Prints status. It does not change the service.

#!/bin/sh
set -eu
nginx -T 2>/dev/null | grep client_max_body_size || echo "No client_max_body_size in the loaded config, or nginx is absent."