Nginx+PHP+FastCGI的部署

nginx(发音同 engine x)是一款俄羅斯的程式設計師Igor Sysoev所開發轻量级的網頁伺服器、反向代理伺服器以及电子邮件(IMAP/POP3)代理服务器,并在BSD-like协议下发行,可以在UNIX, GNU/Linux, BSD, Mac OS X, Solaris, 以及 Microsoft Windows等操作系统中运行,据说这款web容器在高并发链接下的工作效率要大大高于Apache,所有要好好研究研究,本节中将简要的介绍下部署nginx+php+fastcgi环境

[root@server5 ~]# yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap
openldap-clients     //安装GCC编译器和基本的库文件RPM包,这些库在编译PHP的时候需要调用
[root@server5 ~]# cd /usr/local/src/tarbag/
[root@server5 tarbag]# wget        //nginx主程序包
[root@server5 tarbag]# wget      //PHP主程序包
[root@server5 tarbag]# wget     //MYSQL主程序包
[root@server5 tarbag]# wget ftp://ftp.eenet.ee/pub/FreeBSD/distfiles/libmcrypt-2.5.8.tar.gz       //安全线程加密库主程序包
Libmcrypt is a thread-safe library providing a uniform interface to access several block and stream encryption algorithms.

[root@server5 tarbag]# wget      //mhash库主程序包
Mhash is a free (under GNU Lesser GPL) library which provides a uniform interface to a large number of hash algorithms. These algorithms can be used to compute checksums, message digests, and other signatures.

[root@server5 tarbag]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.9.tar.bz2       //正则表达式扩展主程序包
[root@server5 tarbag]# wget           //php的FastCGI进程管理补丁包

[root@server5 tarbag]# tar -zxvf libmcrypt-2.5.8.tar.gz -C ../software/    //编译安装libmcrypt,mhash库
[root@server5 tarbag]# cd ../software/libmcrypt-2.5.8/
[root@server5 libmcrypt-2.5.8]# ./configure && make && make install
[root@server5 tarbag]# tar -zxvf mhash-0.9.9.9.tar.gz -C ../software/
[root@server5 tarbag]# cd ../software/mhash-0.9.9.9/
[root@server5 mhash-0.9.9.9]# ./configure && make && make install
[root@server5 mhash-0.9.9.9]# ln -s /usr/local/lib/* /usr/lib

编译安装:mysql
[root@server5 tarbag]# tar -zxvf mysql-5.1.38.tar.gz -C ../software/
[root@server5 tarbag]# cd ../software/mysql-5.1.38/
[root@server5 mysql-5.1.38]# groupadd mysql
[root@server5 mysql-5.1.38]# useradd -g mysql mysql
[root@server5 mysql-5.1.38]# ./configure --prefix=/usr/local/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

编译安装PHP:
[root@server5 mysql-5.1.38]# cd /usr/local/src/tarbag/
[root@server5 tarbag]# tar -zxvf php-5.2.10.tar.gz -C ../software/
[root@server5 tarbag]# cp php-5.2.10-fpm-0.5.11.diff.gz ../software/
[root@server5 tarbag]# cd ../software/
[root@server5 software]# gzip -cd php-5.2.10-fpm-0.5.11.diff.gz |patch -d php-5.2.10 -p1
[root@server5 software]# cd php-5.2.10
[root@server5 php-5.2.10]# ./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-iscard-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 --with-xmlrpc --enable-zip --enable-soap --without-pear
[root@server5 php-5.2.10]# make && make install
[root@server5 php-5.2.10]# cp php.ini-dist /usr/local/php5/etc/php.ini

编译安装pcre:
[root@server5 ~]# cd /usr/local/src/tarbag/
[root@server5 tarbag]# tar -jxvf pcre-7.9.tar.bz2 -C ../software/
[root@server5 tarbag]# cd ../software/pcre-7.9/
[root@server5 pcre-7.9]# ./configure && make && make install

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wydfdf.html