tar xzvf php-5.3.28.tar.gz
cd ./php-5.3.28
yum install libxml2
yum install libxml2-devel -y
./configure --prefix=/usr/local/php --enable-fastcgi --enable-fpm
make
make test
make install
cp /opt/php-5.3.28/php.ini-development /usr/local/php/lib/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf
listen = 10.10.7.60:9001
/usr/local/php/sbin/php-fpm -y /usr/local/php/etc/php-fpm.conf
tar xzvf pcre-8.35.tar.gz
cd ./pcre-8.35
./configure --prefix=/usr/local/nginx/pcre
make && make install
tar xzvf nginx-0.8.55.tar.gz
cd ./nginx-0.8.55
./configure --prefix=/usr/local/nginx --with-pcre=/opt/pcre-8.35 --with-http_realip_module --without-http-cache
make && make install
vi /usr/local/nginx/conf/
http {
include mime.types;
default_type application/octet-stream;
upstream myapp {
# server 10.10.42.6:9000 weight=1;
server 10.10.7.60:9002 weight=1;
server 10.10.7.60:9003 weight=1;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root html; ################修改为绝对路径时表示在php环境下绝对路径
#fastcgi_pass 10.10.7.60:9001;
fastcgi_pass myapp;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #####$document_root 为root定义路径
include fastcgi_params;
}