Help troubleshooting Nginx + Php-Fpm Set up

Researched this issue many times and now need help understanding some diagnostics. Basically switched a server over from Apache + Php regular to Nginx + php-fpm . The problem is after a small increase in users Nginx starts encountering 503 and 502 errors. The main error we see in the log is “Connection reset by peer”. I ran iostat and top commands sorted by CPU usage and need help understanding if these are normal. We stress tested with Apache Jmeter and as you can see in the top graphic many child processes get created with about 30 - 40 % cpu. I can’t imagine that being good. Also when running iostat the avg-cpu %user column jumps to the 90th percentile . I can’t imagine that being good either. The stress test we did was 100 users in 60 seconds which is the kind of activity this site gets. I imagine this is a php script causing this problem , particularly wordpress. Does anyone have suggestions where to begin debugging this problem? So far we have tried increasing the buffer size, increasing the timeouts in php and nginx, but nothing has worked.

Image for iostat

Image for top


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


Not sure how I missed this one as I normally get flagged when NGINX is tagged in a post, though if you’ve not already found a solution, hopefully I can help.

When it comes to NGINX, it’s all about the configuration. To really get an idea of what we’re working with, I’d need to see your configuration – specifically nginx.conf and how you’ve configured each of your server blocks.

It’d also be beneficial to take a look at the pool files that you’ve setup for each site for PHP-FPM.