Nginx + WordPress, I need help with the last stretch

Almost there with my LEMP server. I built it using the tutorial here.

Finally was able to install a test wp site here.

My only problem now is that uploading a zip file of a theme with filesize 800Kb never completes. The browser stops always at 77%. I tried uploading other themes or image files and the same thing happens. It gets stuck at loading at some point and never completes. Using Firefox to upload media files, WordPress gives me "IO error."

Nginx site Error log:

2011/11/12 23:01:04 [error] 5465#0: *29 client intended to send too large body: 1247250 bytes,

Uploading files via sftp also stops after a while, with this message:

Network error: Software caused connection abort.

I have already increased the clientmaxbodysize in my nginx conf and uploadmax_filesize in php.ini both 64M. Also restarted both services and checked phpinfo to make sure the upload size is really updated.

I'm not really a programmer. Just a web designer who would like to host my site in nginx so I'm really stumped. Any expert advice is greatly appreciated.

Thanks.

12 Replies

I am the other newbie here, but I find it strange that a file of 800 kB stops uploading after 77%, but that the nginx error mentions 1.2 MB.

Never encountered this error, but can offer you 2 work arounds, no solutions, to get you going:

1. Unzip the theme on your computer and upload directory to your site with sftp (individual files and folders instead of 1 big file).

2. Log in on your server with ssh, go to themes directory, and download theme with wget.

I regularly upload files up to 10 MB to my server. Never experienced the "Network error: Software caused connection abort. "

My mistake with the nginx error. It must have been the other image file I tried to upload but stopped too. That was 1.7Mb. I already tried your suggestion #1 but even with sftp some files do not completely upload. I notice that those files are bigger than 1MB.

Nginx or PHP configs should not have an effect on sftp right?

Maybe I will just do a clean install and start from scratch :cry:

If you really did not touch firewall and sysctl, then are you sure that you PC is in OK condition? Maybe you have some local problem that prevents you from uploading? Try another browser for example and check your PC for viruses.

Did you ever figure this out?

Once I ran into a problem uploading a large WordPress import (XML?) and "clientmaxbody_size 5M;" solved my problem. Did you remember to restart NginX after changing the config file? Check your error logs to see if there's any useful information there.

I'm not sure what OS you have at home but I often use "sshfs" when uploading themes. So when you turn on your PC, automatically mount all your Linodes into subdirectories with sshfs, like /joeslinode /frankslinode etc.

Once you have this set up (time well spent) you can drag and drop themes from your PC to your Linode, or save themes, photos, whatever off the web right to your Linode, or drag a theme from "joes" Linode to "franks" Linode. Huge time saver, I haven't used something like "Filezilla" in ages.

In Linux you can bookmark your remote theme directories if you're lazy–they're always just one click away!

Sorry I don't know the answer to your "big files" question--maybe try an NginX forum. If you get desperate, the author (Igor) is very helpful.

@ilokano:

My mistake with the nginx error. It must have been the other image file I tried to upload but stopped too. That was 1.7Mb. I already tried your suggestion #1 but even with sftp some files do not completely upload. I notice that those files are bigger than 1MB.

Nginx or PHP configs should not have an effect on sftp right?

Maybe I will just do a clean install and start from scratch :cry:

I keep clientmaxbodysize (nginx.conf), uploadmaxfilesize (php.ini), and postmax_size (php.ini) at 10M.

I used to increase when I got the same error. I took a look at my error.log and realized that the memory limit was being exceeded. A fix online stated it was a WordPress issue, not Nginx. Just add the following to wp-config.php.

/** Wordpress Memory Limit */
define('WP_MEMORY_LIMIT', '128M');

I set it to 128M but I probably just need 64M.

Hope this helps.

Please don't define the WP memory limit higher then the limit it can actually use (10M in your case), this'll just lead to a whole new level of hell when WP tries allocating more memory then it can and starts throwing pretty exception errors at your face just by looking at the admin panel :)

@Marius:

Please don't define the WP memory limit higher then the limit it can actually use (10M in your case), this'll just lead to a whole new level of hell when WP tries allocating more memory then it can and starts throwing pretty exception errors at your face just by looking at the admin panel :)

Ok, duly noted. :)

@ferodynamics:

I'm not sure what OS you have at home but I often use "sshfs" when uploading themes. So when you turn on your PC, automatically mount all your Linodes into subdirectories with sshfs, like /joeslinode /frankslinode etc.

Once you have this set up (time well spent) you can drag and drop themes from your PC to your Linode, or save themes, photos, whatever off the web right to your Linode, or drag a theme from "joes" Linode to "franks" Linode. Huge time saver, I haven't used something like "Filezilla" in ages.

Thanks for the message. I already did a clean install using a perfect ubuntu + nginx setup from howtoforge and that seemed to fix things. I am curious about sshfs so I googled about it and found a version called Dokan for windows. I think I will try that.

Thanks for all the messages.

In the end I did a clean install. I never really found out the cause of the problem. Could have been something in my setup, my filezilla not playing well with sftp connection, or my firewall (server and local). But I did a clean install with instructions from howtoforge ubuntu 11.10 + nginx + ispconfig3 and things have been running fine for several days now.

Here is my live site finally migrated to Linode nginx:

http://www.jasperespejo.com/

My question now is what's your suggestion for optimized php-fpm conf. My current setup:

pm = dynamic

pm.max_children = 10

pm.start_servers = 3

pm.minspareservers = 1

pm.maxspareservers = 5

…this is for my website I linked above.

I would like to squeeze a few more WP sites I own into this server (Linode 768). Maybe 3-4 sites on this server with low traffic of only around 1,000-2,000 visitors per month. Would my server be able to handle the load?

I'm glad you solved your problem, even if we don't know exactly what caused it!

@ilokano:

My current setup:

pm = dynamic

pm.max_children = 10

pm.start_servers = 3

pm.minspareservers = 1

pm.maxspareservers = 5

…this is for my website I linked above.

I would like to squeeze a few more WP sites I own into this server (Linode 768). Maybe 3-4 sites on this server with low traffic of only around 1,000-2,000 visitors per month. Would my server be able to handle the load?

Of course depends on what you're doing but most likely you're fine with that many visitors on a Linode.

I don't know how fpm works (I use spawn) but you may not need that many children. You can end up with lots of children sitting around consuming resources. I served 10,000 visitors/day with 3 children and never had trouble. My thinking is, fewer children = faster children. Of course there are other factors to consider, I don't know the exact point where 4 children becomes better than 3 for you, but I'd consider the law of diminishing returns–if fpm doesn't figure that out automatically.

/** Wordpress Memory Limit */ define('WP_MEMORY_LIMIT', '128M');

I set it to 128M but I probably just need 64M.

Hope this helps.

I wonder if there's any benefit to lowering this. 8M doesn't really work, but 16M seems to work fine. But when I run "top" I don't see memory savings by lowering this value.

@ferodynamics:

/** Wordpress Memory Limit */
define('WP_MEMORY_LIMIT', '128M');

I set it to 128M but I probably just need 64M.

Hope this helps.

I wonder if there's any benefit to lowering this. 8M doesn't really work, but 16M seems to work fine. But when I run "top" I don't see memory savings by lowering this value.

10M was not enough for me, some WP guys are using 64M. I want to bring it down to 32M and just play it by ear until I find the right value.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct