Re: Using nginx / haproxy / apache setupr?

From: Aleksandar Lazic <al-haproxy#none.at>
Date: Sun, 22 Nov 2009 12:32:15 +0100


Hi,

On Sam 21.11.2009 11:44, Ryan Chan wrote:
>Hello,
>
>On Sat, Nov 21, 2009 at 7:38 AM, Aleksandar Lazic <al-haproxy#none.at>
>wrote:
>>
>> You should setup haproxy so that the 'slow clients' don't eat all
>> connections to apache.
>>
>
>That's mean HA Proxy can handle this for me, and nginx is useless in my
>above setup?
>
>(Since I don't use nginx/fast_cgi to serve PHP, I use apache)

Well depend on what you want to do.

http://haproxy.1wt.eu/download/1.3/doc/architecture.txt

 From the current informations we have, yes you can use the setup without nginx, but then the apache delivers not only the dynamic content also the static one, what he can, of course ;-).

Another possible solution is to deliver the static content from nginx and only the dynamic one goes to apache.

http://haproxy.1wt.eu/download/1.3/doc/configuration.txt

###
default_backend <backend>

   Specify the backend to use when no "use_backend" rule has been matched.    May be used in sections : defaults | frontend | listen | backend

                                  yes   |    yes   |   yes  |   no
   Arguments :
     <backend> is the name of the backend to use.

   When doing content-switching between frontend and backends using the    "use_backend" keyword, it is often useful to indicate which backend will be    used when no rule has matched. It generally is the dynamic backend which    will catch all undetermined requests.

   The "default_backend" keyword is also supported in TCP mode frontends to    facilitate the ordering of configurations in frontends and backends,    eventhough it does not make much more sense in case of TCP due to the fact    that use_backend currently does not work in TCP mode.

   Example :

         use_backend     dynamic  if  url_dyn
         use_backend     static   if  url_css url_img extension_img
         default_backend dynamic

   See also : "use_backend", "reqsetbe", "reqisetbe" ###

### 7.7. Using ACLs to form conditions

.
.
.

To select a different backend for requests to static contents on the "www" site and to every request on the "img", "video", "download" and "ftp" hosts :
    acl url_static  path_beg         /static /images /img /css
    acl url_static  path_end         .gif .png .jpg .css .js
    acl host_www hdr_beg(host) -i www     acl host_static hdr_beg(host) -i img. video. download. ftp.

    # now use backend "static" for all static-only hosts, and for static urls     # of host "www". Use backend "www" for the rest.     use_backend static if host_static or host_www url_static     use_backend www if host_www

See section 4.2 for detailed help on the "block" and "use_backend" keywords. ###

Effect, you can answer some sorry sites from nginx and apache doe his heavy work.

Another way is to use switch to nginx/fast_cgi and remove apache from the setup, if it's possible.

So you see there is not only one way to solve your issue.

Hth

Aleks Received on 2009/11/22 12:32

This archive was generated by hypermail 2.2.0 : 2009/11/22 12:45 CET