the dispatch.cgi thing was meant for fastcgi setups without mongels, but noone is using that anymore.

i don't think you need any rewrites at all.

by pointing the document root to the public dir and the ProxyPass that end with "!" will make apache serve them statically without bothering your mongrels.
everything else will then be directed to the cluster.

here is an example container i'm using

this is with windows authentication utilizing an active directory domain and injecting the authenticated user into the headers for further use within my app controller assets like images / stylesheets and javascripts get served directly and are also memcached and all text content getting gzip compressed which saves about 70% of traffic

<VirtualHost *:80>
  ServerName someserver.domain.de
  DocumentRoot "C:/rails/public/"

  ErrorLog "C:/rails/log/balancer_error.log"

  CacheEnable mem /images
  CacheEnable mem /stylesheets
  CacheEnable mem /javascripts
  CacheEnable mem /latest/images
  MCacheSize 64000000
  MCacheMaxObjectCount 10000
  MCacheMinObjectSize 1
  MCacheMaxObjectSize 20480

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/ css application/json text/json application/xml application/xhtml+xml text/javascript application/javascript application/x-javascript

  ProxyRequests Off
  ProxyVia On
  ProxyPreserveHost On

  ProxyPass /balancer !
  ProxyPass /images !
  ProxyPass /stylesheets !
  ProxyPass /javascripts !

  ProxyPass / balancer://mongrelcluster/
  ProxyPassReverse / balancer://mongrelcluster/

  <Proxy>
    AuthName "Windows Authentication"
    AuthType SSPI
    SSPIAuth On
    SSPIAuthoritative On
    SSPIOfferSSPI On
    SSPIOfferBasic On
    SSPIBasicPreferred On
    SSPIPerRequestAuth On
    SSPIDomain somedomain
    Require valid-user

    RewriteEngine On
    RewriteCond %{REMOTE_USER} (.+)
    RewriteRule . - [E=RU:%1]
    RequestHeader set REMOTE_USER %{RU}e
  </Proxy>

  <Proxy balancer://mongrelcluster>
    BalancerMember http://127.0.0.1:3101
    BalancerMember http://127.0.0.1:3102
    BalancerMember http://127.0.0.1:3103
    BalancerMember http://127.0.0.1:3104
    BalancerMember http://127.0.0.1:3105
    BalancerMember http://127.0.0.1:3106
  </Proxy>

  <Location /balancer>
    SetHandler balancer-manager
    AuthName "Windows Authentication for Balancer"
    AuthType SSPI
    SSPIAuth on
    SSPIOfferSSPI on
    SSPIOfferBasic off
    SSPIBasicPreferred On
    SSPIUsernameCase lower
    SSPIDomain somedomain
    Require group "somedomain\domain admins"
  </Location>

</VirtualHost>


--
Freundliche Grüße,
Ralf Vitasek


o
L_
OL

This is Schäuble.
Copy Schäuble into your signature
to help him on his way to Überwachungsstaat




Am 16.06.2008 um 12:27 schrieb Guido Holz:

uff... I saw this on an turorial.. but something went wrong.. know I
have no time to cahnge and try out what´s right :-(

So what handles the cached static-html-sites on your proxypasses?!? is
this realy enough?

another question is the difference between

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

and

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]


do I need the first or the second one?!?

thanks guido

neongrau __ wrote:
why do you need rewrites at all?

just point your document root to the rails public dir
and these ProxyPass settings should be enough

  ProxyPass /images !
  ProxyPass /stylesheets !
  ProxyPass /javascripts !
  ProxyPass / balancer://mongrelcluster/
  ProxyPassReverse / balancer://mongrelcluster/



--
Freundliche
Gr��e,Ralf Vitasek


o
L_
OL

This is Sch�uble.
Copy Sch�uble into your signature
to help him on his way to �berwachungsstaat




Am 16.06.2008 um 11:47 schrieb Guido Holz:

--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to