LEMP Stack WordPress: HTTP Error

Over the last few days when I’ve tried to upload images over a certain size, I’ve been greeted with this lovely WordPress HTTP error message right after the upload fails:

wordpress http error

The problem here is with NGINX configuration (or, if you’re using Apache, check out this blog post.)

Turns out there’s a very simple fix!

Step 1: Log in to your VPS or FTP or however you edit your WordPress files.

Step 2: Open the nginx.conf file located at /etc/nginx/nginx.conf.

Step 3: Add client_max_body_size 2m; to the http section. It should look something like this:

http {
	##
    # Basic Settings
    ##
	
	client_max_body_size 100m;

	...
	...
	...
}
/etc/nginx/nginx.conf

Note: This limits uploads to 2mb, which is generally the image size limit for WordPress. You can change client_max_body_size to whatever you’d like, but WordPress limits must be adjusted elsewhere. See NGINX documentation on client_max_body_size here.

Step 4: Restart NGINX. If you’re using the command line of a VPS, simply type sudo service nginx restart.

At this point, you should be able to upload images without errors!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.