Nginx and PHP-FPM Configuration and Optimizing Tips and Tricks - Comment Page: 6

I wrote before a guide Howto install Nginx/PHP-FPM on Fedora 29/28, CentOS/RHEL 7.5/6.10, but this guide is just installation guide and many cases Nginx and PHP-FPM basic configuration is good enough, but if you want to squeeze all the juice out of your VPS or web server / servers and do your maintenance work little bit easier, then this guide might be useful. These tips are based entirely on my own experience, so they may not be an absolute truth, and in some situations, a completely different configuration may work better. It's also good to remember leave resources for another services also if you run example, MySQL, PostgreSQL, MongoDB, Mail server, Name server and/or SSH server on same...

168 comments on “Nginx and PHP-FPM Configuration and Optimizing Tips and Tricks - Comment Page: 6

1 4 5 6
    1. If i have a 10 K concurrent user , and 8 core server process .. request size is about 4 KB , and response size is about 20 KB ,

      what is the best configuration should i use .. and please how I could calculate values based on requests per server ( with nginx load balancer ) , cores and ram size

      Reply
    2. fastcgi_pass 127.0.0.1:9000;
      #fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;

      If php-fpm and nginx are the same box, it might be better to use the socket approach (better performance, no tcp overhead)

      Reply
    3. pm.start_servers = 3
      pm.min_spare_servers = 2

      does not make sense

      Reply
    4. Thanks for Gre8 and useful information.

      Reply
    5. hey,
      im experiencing Very hige cpu load,
      i have 16Gb of ram and 6cpus ,
      but everytime i have high traffic on my site some of the pages get nginx error 500

      Reply
      • Hi Zion,

        Could you tell more how much traffic you have, what configs you are using and do you run some custom site? And what cause high cpu load, nginx or php-fpm?

        Reply
    6. Hi We have 10 GB data to be synchronized between moodle and wordpress. When I try to synchronize, it shows error: 504 Bad Gateway TimeOut. Please guide. What should be memory parameters in nginx and php-fpm.

      Reply
      • Hi GAURAV,

        What method you are using to synchronize this data? It sounds like a really long and heavy operation over the HTTP protocol. Is it possible run on server (using php-cli)?

        Reply
    7. hi, thanks for this tips, i follow them and i have a better performance, but i have some troubles on concurrency, in the load testing almost, all request are failing, can i send you the config files?

      Reply
      • Hi Andres,

        Nice to hear that you find this helpful and of course you post config files and please tell also your server(s) specs.

        Reply
    8. Thanks a lot for these good described tips!

      Reply
    9. > cat /proc/cpuinfo |grep processor
      is the hard way to do that, all you need is
      grep -c ^processor /proc/cpuinfo

      Reply
    10. hi
      im getting the 499 status in windows environment

      127.0.0.1 – – [03/May/2019:15:52:32 +0000] “POST /store.php HTTP/1.1” 499 0 “-” “-”

      how ill fix this

      Reply
    11. I find this helpful. Thanks for sharing.

      Reply
    12. Thanks for the tips, NGINX optimization is crucial in such cases.

      Reply
    13. I have high CPU usage.

      1CPU
      2GB Ram

      Site at the most 100 concurrent users.

      pm.max_children = 20
      pm.start_servers = 8
      pm.min_spare_servers = 4
      pm.max_spare_servers = 12
      pm.max_requests = 500

      Reply
1 4 5 6

Leave a Reply to Tim Cancel reply

Your email address will not be published. Required fields are marked *

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

Close