1、所需安装包
nginx-1.0.9.tar.gz
nginx_upstream_hash.tar.gz
pcre-8.10.tar.gz
php-5.3.6.tar.bz2
mysql-5.1.55.tar.gz
 
2、安装nginx
cd /web/nginx/
tar –xzf nginx-1.0.9.tar.gz
tar –xzf nginx_upstream_hash.tar.gz
tar –xzf pcre-8.10.tar.gz
cd nginx-1.0.9
patch -p0 < /web/nginx/nginx_upstream_hash/nginx.patch
./configure --add-module=/web/nginx/nginx_upstream_hash/ --with-pcre=/web/nginx/pcre-8.10/ --prefix=/usr/local/nginx --with-http_stub_status_module --without-select_module  --without-poll_module  --with-http_realip_module  --with-http_p_w_picpath_filter_module  --with-http_gzip_static_module  --with-http_random_index_module --with-http_perl_module
make && make install
配置nginx.conf
location / {
    root   /web/html;
    index  index.php index.html index.htm;
}
location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /web/html/$fastcgi_script_name;
    include        fastcgi_params;
}
/etc/init.d/nginxd check|start|stop
 
3、安装mysql
tar –xzf mysql-5.1.55.tar.gz
cd mysql-5.1.55
./configure --prefix=/usr/local/mysql --with-extra-charsets=all --enable-shared --enable-static --with-comment  --with-pthread --enable-assembler  --with-mysqld-ldflags=-all-static --with-plugins=innobase
make && make install
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
cp support-files/my-large.cnf /etc/my.cnf
groupadd mysql
useradd –g mysql mysql
chown –R mysql:mysql /usr/local/mysql/var
/usr/local/mysql/bin/mysql_install_db --user=mysql
/usr/local/mysql/bin/mysqld_safe
启用/停止数据库
/etc/init.d/mysqld start|stop
 
4、安装php
安装php需要依赖很多其他的包
yum -y install ntpdate pcre pcre-devel libjpeg-devel libpng libpng-devel freetype freetype-devel  curl curl-devel compat-libgcc-296 zlib  curl libcurl libxml2 libxml2-devel libxslt  bzip2 bzip2-devel ncurses ncurses-devel openssl openssl-devel pcre-devel gd gd-devel   libjpeg-devel  libpng libpng-devel freetype freetype-devel libxml2 libxsltl  gd gd-devel     zlib
tar –xjf php-5.3.6.tar.bz2
cd php-5.3.6
./configure --disable-debug --enable-gd-native-ttf --with-freetype-dir=/usr/lib --enable-safe-mode --with-libxml-dir --with-mysql=/usr/local/mysql/ --with-gd --with-zlib-dir --with-jpeg-dir --with-png-dir --disable-posix --with-config-file-path=/etc --enable-mbstring --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-zip --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-curlwrappers --with-gettext --enable-shmop --enable-sockets --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --with-mcrypt --with-curl --enable-ftp
make && make install
cp php.ini-production /etc/php.ini
/etc/init.d/phpcgi.sh stop|start
 
5、phpadmin
将phpmyadmin的目录放到web的应用目录下
再重启nginx,php
 
用数据库的用户名和密码,就可以登录了