Are we sure about that discourse/config/nginx.sample.conf at main · discourse/discourse · GitHub
# maximum file upload size (keep up to date when changing the corresponding site setting)
client_max_body_size 2m;
You would need to add a hook to replace that in nginx to your template