Skip to main content

Notebook entry

Tutorial: Scripting a NGINX, PHP-FPM, and MySQL installer for CentOS

Lovell Felix 1 min read

Archive note: the tools and versions have moved on. I have kept this entry because the debugging path and the underlying constraint may still be useful.

Provisioning a web server by hand a few times teaches you the steps. Provisioning it a dozen times teaches you to script it. This is the installer I landed on for standing up a clean LEMP stack on a fresh CentOS 5 box, moving off Apache/mod_php entirely rather than running it alongside nginx, as a gist:

A few notes on what's in there. The OpenVZ check partway through is specific to that virtualization platform's quirks around resource limits and yum plugins; skip that block entirely on real hardware or KVM. The MySQL config at the bottom is deliberately minimal, a starting point tuned for a small box rather than a production baseline: key_buffer and query_cache_size in particular need to scale with actual available memory and workload, not stay at these placeholder values.

Why script it at all

None of these commands are individually hard. The value is in not retyping them, and not forgetting the one step (disabling sendmail, say) that only matters because of something that broke on a server three months ago. A script is a memory that doesn't degrade.

About the author

Lovell Felix

Infrastructure and reliability engineer working on Linux platforms, configuration delivery, and deployment safety at fleet scale.

@lovellfelix

Continue through the notebook