nginx php分布在两台机器上部署

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;
        }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值