![]() For reference here is a copy of the default version I’ve got. The main PHP- FPM configuration file is /etc/php5/fpm/nf. ![]() On my system (with about 512mb of RAM), that means after everything else is running I can easily allow up to 5 php-fpm processes. In the meantime, we’ll just go with some pretty safe (low) defaults, since it’s vastly better to have some free resources available than the alternative.įrom simple observation, I’ve seen that my php-fpm processes tend to start off small and slowly grow into the 20-25mb range as they serve requests. ![]() Once you’re done and your box is serving normal levels of traffic you’ll have to keep an eye on the amount of free memory you have available and how many processes php-fpm usually has hanging around and make adjustments. How do you get the right mix, then? Well, that’s going to take more than a single config session to figure out. Of course if you set everything too high, you’ll run out of memory during a spike in traffic because PHP- FPM is trying to process too many requests simultaneously and your box will jump over the cliff and kill itself. If you set everything too low, you’ll have spare memory sitting on your system not being used and during a spike in traffic clients could end up queueing up endlessly, waiting for their turn for PHP to process their request. If you’ve ever configured Apache this will be very familiar (and possibly miserable). You see, you have to tell PHP- FPM how many separate processes it should be allowed to spawn at any one time. This is the only place where we have to do a little math, and perform some guesswork. Once it’s done churning, it’s time to configure your PHP- FPM pool to handle requests. In my standard production setups, I usually add php5-cli php5-curl php5-mcrypt php5-mysqlnd php5-sqlite.Īccept any dependencies aptitude wants to install. You’ll also want to install whichever other PHP packages you need for your specific setup. This is ridiculously simple, you’ll just need to install the php5-fpm package: The packages and default configs should remain very similar, regardless of your exact version (or even if you’re using Debian).īefore you install anything new on your box you should always make sure you’ve updated the list of available packages and upgraded any that have updates available: I’ve used these same basic steps to install PHP- FPM and Nginx on a variety of versions of Ubuntu. So I’m going to try and take you through setting everything up, from scratch, the right way. The standard set of config adjustments I use have been assembled from dozens of places and lots of time, reading, and experimentation. Unfortunately, it turns out some of the guides floating around (even some written and publicized by major hosting companies) are helping users configure things sub-optimally and in some cases outright wrong. Knowing that I run Nginx exclusively (and set up and maintain the instance that hosts the Habari website itself), they’ve asked questions from time to time. There have been several fellow members of the Habari community that have decided to switch to Nginx lately. Supposedly about config, debian, guide, nginx, optimization, php, php-fpm, sysadmin, and ubuntu.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |