Linux+Nginx+PHP5.29架设高性能WEB服务器

huhui0 2010-10-12

系统环境
Linux version 2.6.9(CentOS release 4.7(Final))

软件环境
nginx-0.6.35.tar.gz
当前稳定版: Nginx 0.6.35 (2009年1月26日)
官方Wiki:http://wiki.nginx.org
官方下载:http://sysoev.ru/nginx/nginx-0.6.35.tar.gz

php-5.2.9.tar.gz
官方下载:http://www.php.net/get/php-5.2.9.tar.gz/from/this/mirror

php-5.2.9-fpm-0.5.10.diff.gz
官方下载:http://php-fpm.anight.org/downloads/archive/

mysql-5.1.34.tar.gz

libiconv-1.13.tar.gz

libmcrypt-2.5.8.tar.gz

mcrypt-2.6.8.tar.gz

mhash-0.9.9.9.tar.gz


Nginx0.6.35+Php5.2.9所有相关安装包下载 (在安科网FTP里)

--------------------------------------------------------------------

FTP地址:ftp://www.6688.cc/

用户名:www.linuxidc.net

密码:www.6688.cc

安装步骤
一、 编译安装PHP5.2.9所需的支持库

tar zxvf libiconv-1.13.tar.gz
cd libiconv-1.13/
./configure --prefix=/usr/local
make
make install
cd ../

tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../

tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1

tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../


二、编译安装MySQL 5.1.34扩展库

/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
tar zxvf mysql-5.1.34.tar.gz
cd mysql-5.1.34/
./configure --prefix=/usr/local/webserver/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase
make && make install
chmod +w /usr/local/webserver/mysql
chown -R mysql:mysql /usr/local/webserver/mysql
cd ../

MySql的安装此处就省略


三、编译安装PHP(FastCGI模式)

tar zxvf php-5.2.9.tar.gz
gzip -cd php-5.2.9-fpm-0.5.10.diff.gz | patch -d php-5.2.9 -p1
cd php-5.2.9/
./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql --with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/webserver/php/etc/php.ini
cd ../

相关推荐