Installing proper Web (or other) environment is a common task. Below I provide a link to an archive containing source files and a script to install the following software:
5.3.10 (FPM enabled) + PHP-FPM FastCGI service
1.0.14, high-efficiency Web server (it can also work as Web/mail proxy)
high speed memory caching server (initially created to speed up LiveJournal)
Note that script is no magic wand. I use it to create predefined pieces of software. Custom tuning is always required afterwards, but at least you will have very efficient Web environment with a good average settings.
The script assumes you run CentOS 6.x, 32-bit or 64-bit version, or compatible OS. Note that libmemcached isn't compatible with CentOS 5.x or below, thus the building would break.
How to use: download this archive
(14Mb), run antivirus software if you're really paranoid (as I am). Follow the following steps.
1. Unpack the entire archive into
(if you choose any other location, change base source directory in
to whatever meets your needs)
and wait until completion. It may take 10-45 minutes to build all the software, depending on your server efficiency
What this script does:
1. Builds FPM version of PHP 5.3.* and installs XCache opcode cache
2. Builds memcached daemon binary and libmemcached library to communicate with it; also installs PHP memcached PECL extension
3. Builds Nginx and copies a basic configuration suitable for most PHP-driven sites
4. Creates /local/www/localhost as Web root for the default site and places an index.php invoking phpinfo() there
The script adds the following services and marks them to run upon startup:
Script also adds memcached to autostart (see /etc/rc.d/rc.local) and adds path to PHP binaries to /etc/profile
Note that script installs software in the following manner:
and makes a symlink of the kind
/usr/local/package -> /usr/local/package-version
E.g., in case of PHP:
/usr/local/php -> /usr/local/php-5.3.10-fpm
This allows you to compile several separate versions and easily assign
any of them as default one.
Note: you are strictly advised to browse and correct
- to specify the amount of memory used by memcached
- to tune your PHP installation to your needs
- to tune your PHP-FPM FastCGI server
- to tune your Nginx installation
Make sure you insert proper domain name into nginx.conf. After you do that,
run these commands
service php53-fpm start
service nginx start
and open the mentioned domain in browser. If everything (including domain's
DNS) are set up correctly, you'll see phpinfo() output.
The script isn't that terribly clever or flexible. Additional functionality might be added if sufficient amount of requests is received. The script is basically what I run to provide the base of Web environment for my sites.
Script understands different versions of the mentioned pieces of software automatically when building. Just replace the source tarballs prior to running and unlink the mentioned symlinks in /usr/local
Bring your comments/suggestions via PM and/or use contact form