Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

thomthom's avatar

How to fix 413 Request Entity Too Large - n00b edition?

I just deployed a site on forge, and as I was testing a file upload form I ran into "413 Request Entity Too Large" error.

Searching for it there appear to be some "nginx" configuration that needs to be set. However, my n00bness here appear to defeat me. I don't actually know how I do this on a forge server.

From the forge control panel I found a Edit Files button in the Site view. This lead me to a screen that says "Edit ngix Configuration" and the content:

server {
    listen 80;
    server_name staging.example.com;
    root /home/forge/staging.example.com/public;

    # FORGE SSL (DO NOT REMOVE!)
    # ssl_certificate;
    # ssl_certificate_key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/staging.example.com-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

Can I simply add client_max_body_size 10M; somewhere in that file? (Any particular order this needs to be in)?

If that isn't the location? Where and how do I do this on a forge site?

0 likes
3 replies
thomthom's avatar

Also, apparently one has to restart nginx after making changes - even this is something I'm not sure how you do on forge.

thomthom's avatar

It's me again - talking to myself. I appear to have solved my own problem. I was at first hesitant to make changes because I wasn't sure what I was doing. Then I figured that this was only a fresh staging site I had set up and it would be no problem starting over.

tl;dr:

  1. From Site Details > Edit Files > Edit Nginx Configuration
  2. Add client_max_body_size 10M; anywhere within the server {} section.
  3. Save
  4. Profit!

And that was it - everything automatically worked from there. Forge is so easy that I make it more complicated than necessary.

Nothing more to see here. `

1 like
thomthom's avatar
thomthom
OP
Best Answer
Level 7

uhm... did I really miss the obvious?

Server Details > Meta > Max File Upload Size? sheeesh!

5 likes

Please or to participate in this conversation.