On 7/10/06, Jens Kraemer <[EMAIL PROTECTED]> wrote:
> On Fri, Jul 07, 2006 at 06:30:42PM -0400, Mike Garey wrote:
> > if I shut down mongrel, I get the following:
> >
> > Service Temporarily Unavailable
> >
> > The server is temporarily unable to service your request due to
> > maintenance downtime or capacity problems. Please try again later.
> >
> > so it looks like it _is_ being served through mongrel.. I guess this
> > means my rewrite rules aren't actually serving the static files
> > through apache..  Any ideas?
>
> how is your mod_proxy configured ? Do you use ProxyPass or do you Proxy
> by using [P] with a rewrite rule ?
>
> Posting your virtual host's apache configuration might help.

I'm using pretty much the exact same configuration as outlined in the
site 
<http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/>


<VirtualHost *:80>
ServerName myapp.mydomain.com
  DocumentRoot /usr/local/www/data/vhosts/www.mydomain.com/current/public

  <Directory "/usr/local/www/data/vhosts/www.mydomain.com/current/public">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

  ProxyPass / balancer://myapp/
  ProxyPassReverse / balancer://myapp/

  RewriteEngine On

  # Check for maintenance file and redirect all requests
  RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
  RewriteCond %{SCRIPT_FILENAME} !maintenance.html
  RewriteRule ^.*$ /system/maintenance.html [L]

  # Rewrite index to check for static
  RewriteRule ^/$ /index.html [QSA]

  # Rewrite to check for Rails cached page
  RewriteRule ^([^.]+)$ $1.html [QSA]

  # Redirect all non-static requests to cluster
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ balancer://myapp%{REQUEST_URI} [P,QSA,L]

ErrorLog /var/log/apache22/myapp_errors_log
  CustomLog /var/log/apache22/myapp_log combined
</VirtualHost>

now, I don't know much about url rewriting, but it looks like it only
sends a request through the balancer if a file with the requeted name
doesn't exist.. So I can't understand why static files will no longer
work if I shutdown mongrel..  In theory, I should be able to stop
mongrel and have _all_ my static files served directly through apache

Does anyone have any other rewrite rules I should be looking at?  John
Kienitz  posted the following proxypass/rewrite rules in a message
entitled "Apache 2.0 proxy" sent to the list a few days ago:

RewriteRule ^/myrailsapp/images(.*) /myrailsapp/public/images$1
RewriteRule ^/myrailsapp/javascripts(.*) /myrailsapp/public/javascripts$1
RewriteRule ^/myrailsapp/stylesheets(.*) /myrailsapp/public/stylesheets$1

ProxyPass /myrailsapp/images !
ProxyPass /myrailsapp/javascrripts !
ProxyPass /myrailsapp/stylesheets !

which looks like it may explicitly tell apache not to send any
requests for files in images, javascripts or stylesheets through the
proxy balancer (although shouldn't I get the same results by telling
apache to only pass requests through the balancer if a file with the
requested name doesn't exist?).  It seems I'm a bit confused about
configuring the proxy balancer and using rewrite rules (I was hoping
that this would *just work* and I could avoid having to spend too much
time learning about either of these options, you know, the whole
"convention over configuration" thing ;)

I'm scheduled to deploy my app pretty soon, so hopefully I can get
this all sorted out before tthen.  Thanks for your help,

Mike
_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to