1.haproxy的安装请参照:
http://bbs.linuxpk.com/thread-13193-1-1.html
以下是haproxy.cfg配置文件
[root@count haproxy]# cat haproxy.cfg
复制内容到剪贴板
代码:
global
maxconn 5120
chroot /usr/local/haproxy
uid 99
gid 99
daemon
quiet
nbproc 2
#pidfile /var/run/haproxy-private.pid
defaults
log global
mode http
option httplog
option dontlognull
log 127.0.0.1 local3
retries 3
option redispatch
maxconn 2000
contimeout 5000
listen fastcgi 127.0.0.1:8085
mode tcp
balance roundrobin
server srv1 127.0.0.1:80851 check
server srv2 127.0.0.1:80852 check
listen stats :8080
mode http
transparent
stats uri /2.nginx.sh 启动脚本
复制内容到剪贴板
代码:
#!/bin/bash
ulimit -SHn 51200
/usr/local/php-fcgi/bin/spawn-fcgi -a 127.0.0.1 -p 80851 -C 64 -u www -g www -f /usr/local/php-fcgi/bin/php-cgi
/usr/local/php-fcgi/bin/spawn-fcgi -a 127.0.0.1 -p 80852 -C 64 -u www -g www -f /usr/local/php-fcgi/bin/php-cgi
/usr/local/haproxy/haproxy -f /usr/local/haproxy/haproxy.cfg
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf3.结合我以前写的nginx配置文件,原配置文不变关键监听端口为8085
[root@count conf]# cat enable_php5.conf
复制内容到剪贴板
代码:
fastcgi_pass 127.0.0.1:8085;
fastcgi_index index.php;4.效果图