下载包:在官网 http://tengine.taobao.org/download_cn.html下载各种版本的tengine包
./configure
make
make install将tengine设置为service服务
cd /usr/lib/systemd/system
vi nginx.service[Unit]
Description=nginx performance web server
Documentation=http://tengine.taobao.org/documentation_cn.html
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
修改/usr/local/nginx/conf/nginx.conf文件
添加:
pid /var/run/nginx.pid;systemctl enable nginx
systemctl start nginx
systemctl status nginx
192.168.115.128机器修改nginx.conf
 server {
        listen       80;
        server_name  api.x.com;
        location / {
            root   html;
            proxy_pass http://192.168.115.129:9001; #另外一台的nginx监听9001端口
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
}haproxy.conf配置文件修改
frontend  main *:5000
    acl url_static1       path_beg       -i /static /images /javascript /stylesheets /a   #不同的访问路径
    acl url_static       path_end       -i .jpg .gif .png .css .js
    use_backend static1          if url_static1   #a集群
    acl url_static2      path_beg       -i /static /images /javascript /stylesheets /b   #不同的访问路径
    use_backend static2          if url_static2   #b集群
    default_backend             app
#---------------------------------------------------------------------
# static backend for serving up images, stylesheets and such
#---------------------------------------------------------------------
backend static
    balance     roundrobin
    server      static 127.0.0.1:4331 check
#---------------------------------------------------------------------
# round robin balancing between the various backends
#---------------------------------------------------------------------
backend app
    balance     roundrobin
    server  app1 192.168.115.128:80 check
    server  app2 192.168.115.129:80 check
backend static1    #a集群
    balance     roundrobin
    server static1 192.168.115.128:80 check
backend static2   #b集群
    balance     roundrobin
    server static2 192.168.115.129:80 check
访问a集群:
访问b集群:
原文:https://blog.51cto.com/13159674/2506201