====== Setup Nginx and PHP5 (voyage 0.7.5) ====== Nginx is preferred because of small footprint. ===== Setup the dotdeb apt repository ===== # install key wget "http://www.dotdeb.org/dotdeb.gpg" -O - | apt-key add - echo < /etc/apt/sources.list.d/dotdeb.list deb http://packages.dotdeb.org squeeze all deb-src http://packages.dotdeb.org stable all EOT ===== Install packages ===== apt-get install nginx php5 php5-fpm php5-gd apt-get install fcgiwrap ===== Config nginx ===== Relocate temp file folder to save CF: add ''var/lib/nginx'' to VOYAGE_SYNC_DIRS in ''/etc/default/voyage-util'' Tune down process in ''/etc/nginx/nginx.conf'': # max 64 connections: worker_processes 4; worker_connections 16; ===== Config php-fpm ===== Edit ''/etc/php5/fpm/pool.d/www.conf'': pm.max_children = 10 pm.start_servers = 2 pm.min_spare_servers = 2 pm.max_spare_servers = 4 pm.max_requests = 500 ===== Config php ===== Set timezone , error reporting in ''/etc/php5/fpm/php.ini'': date.timezone = "Asia/Hong_Kong" error_reporting = E_ALL & ~E_NOTICE | E_STRICT ===== Config nginx to use fcgiwrap ===== Add this to a server section in nginx to make it serve CGI scripts under ''/var/www/cgi-bin/'': server { ... # setup to serve CGI scripts: location ~ ^/cgi-bin/(.*\.cgi)$ { gzip off; # Fastcgi socket fastcgi_pass unix:/var/run/fcgiwrap.socket; # Fastcgi parameters, include the standard ones include fastcgi_params; # Adjust non standard parameters (SCRIPT_FILENAME) fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name; } ====== Setup Nginx and PHP5 (voyage 0.6.x) ====== Nginx is preferred because of small footprint. Lighttpd is also a good choice but I cannot get it to work with PHP File Navigator. ===== Setup Nginx ===== Use apt-get to install the stock nginx web server. Trim down memory usage, adjust these options in nginx.conf: * worker_processes (e.g. 1) * worker_connections (e.g. 128) ===== Build PHP5 ===== Compile the source using the build-box as the ALIX is too slow for this. Assume we we want to use PHP 5.2.11 Download fpm: php-fpm-0.6-5.2.11.tar.gz, fpm is the php fast CGI manager.\\ Download php: php-5.2.11.tar.bz2 Extract both packages in the same build folder. cd build-folder tar zxvf php-fpm-0.6-5.2.11.tar.gz tar jxvf php-5.2.11.tar.bz2 Build the fpm patch for php, run: php-fpm-0.6-5.2.11/generate-fpm-patch The patch file will be created at the current folder Patch the php source: cd php-5.2.11 patch -p1 < ../fpm.patch if ok, then: ./buildconf --force mkdir fpm-build cd fpm-build ../configure \ --with-fpm \ --with-libevent \ --disable-debug \ --disable-rpath \ --without-gdbm \ --without-sqlite \ --with-gd \ --enable-gd-native-ttf \ --with-zlib \ --enable-mbstring \ --with-mysql make ===== Install PHP5 ===== Copy the build-folder to the voyage box. And run at the voyage box: make install Output excerpt: Installing PHP SAPI module: fpm Installing PHP CLI binary: /usr/local/bin/ Installing PHP CLI man page: /usr/local/man/man1/ Installing build environment: /usr/local/lib/php/build/ Installing header files: /usr/local/include/php/ Installing helper programs: /usr/local/bin/ program: phpize program: php-config Installing man pages: /usr/local/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/lib/php/ [PEAR] Archive_Tar - installed: 1.3.3 [PEAR] Console_Getopt - installed: 1.2.3 [PEAR] Structures_Graph- installed: 1.0.2 [PEAR] XML_Util - installed: 1.2.1 [PEAR] PEAR - installed: 1.8.0 Wrote PEAR system config file at: /usr/local/etc/pear.conf You may want to add: /usr/local/lib/php to your php.ini include_path Installing PHP FPM binary: /usr/local/bin/php-fpm Installing PHP FPM config: /etc/php-fpm.conf Installing PHP FPM man page: /usr/local/man/man1/php-fpm.1 Installing PHP FPM init script: /etc/init.d/php-fpm *** FPM Installation complete. *** run: `update-rc.d php-fpm defaults; invoke-rc.d php-fpm start` or system equivalent to start the php-fpm service. Installing PDO headers: /usr/local/include/php/ext/pdo/ Install any missing dependencies using apt-get. ===== Tuning ===== You should trim down memory use by php-fpm. Check this option in /etc/php-fpm.conf: 5 ----