Hi,
Thanks for your tip Matt. I have intentionally left out rewrite rules
for Rails cached pages simply beacause I don't use them on my page. My
goal was to create fast and as simple as it can be config - no
cluster, no caching, no defalate ...
My full name is Martins Grunskis.
--
Martins
On 10/2/06, Matt Pelletier <[EMAIL PROTECTED]> wrote:
> Hi 13
>
> On Sep 26, 2006, at 3:03 PM, 13 wrote:
>
> > Hello list,
> >
> > Some time ago I was looking for apache (as non balanced proxy) +
> > mongrel configurations. Almost everybody seemed to use similar
> > approaches (one of these could be found @ mongrel.rubygorge.org docs)
> > with mod_rewrite. I don't use proxy_balancer because I don't need it
> > at the moment (my site has pretty low traffic). This is apache
> > configuration that I'm using at the moment. It's tested as Zed
> > suggested (mr start -e production -B) and it looks like all static
> > files are served by apache and dynamic ones be mongrel. Here is my
> > apache config:
> >
> > <VirtualHost *>
> > ServerName myapp.tld
> > ServerAlias www.myapp.tld
> >
> > DocumentRoot /var/www/sites/myapp/current/public
> >
> > <Directory "/var/www/sites/myapp/current/public">
> > Options FollowSymLinks
> > AllowOverride None
> > Order allow,deny
> > Allow from all
> > </Directory>
> >
> > RewriteEngine On
> >
> > # Check for maintenance file. Let apache load it if it exists
> > RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
> > RewriteRule . /system/maintenance.html [L]
> >
> > # Let apache serve static files
> > RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
> > RewriteRule (.*) $1 [L]
> >
> > # Don't do forward proxying
> > ProxyRequests Off
> >
> > # Enable reverse proxying
> > <Proxy *>
> > Order deny,allow
> > Allow from all
> > </Proxy>
> >
> > # Pass other requests to mongrel instance
> > ProxyPass / http://127.0.0.1:8200/
> > ProxyPassReverse / http://127.0.0.1:8200/
> >
> > </VirtualHost>
> >
> > It would be great if some expert could take a look at my config and
> > point me at my mistakes etc ! I am asking this because it looks like
> > it just works, and it makes me think that it can't be so easy :)
> >
>
> Based on the above rules, Apache will only try to find files that
> match the request URI, as it is given. This will indeed work for
> images, SWFs, JS, CSS, and any HTML requested directly. However if
> you are doing something like Rails' page caching, and want to serve
> cached HTML, you will need extra rules to rewrite the URI and have
> Apache check for that (e.g. if the URI is '/articles/' then look for
> '/articles/index.html' on the file system, if that doesn't exist then
> forward the original URI to Rails).
>
> You can determine which server is serving the files by using curl -I
> (capital I as in India)
>
> (Hello Apache)
> $ curl -I http://somedomain.com/static/file/url/
> HTTP/1.1 200 OK
> Date: Mon, 11 Sep 2006 23:13:05 GMT
> Server: Apache/2.2.3 (Unix)
> Last-Modified: Sun, 10 Sep 2006 18:21:52 GMT
> ETag: "21ac8f5-9d0a-83f57000"
> Accept-Ranges: bytes
> Content-Length: 40202
> Vary: Accept-Encoding
> Connection: close
> Content-Type: text/html
>
> (Hello Mongrel)
> $ curl -I http://somedomain.com/go_to/rails/
> HTTP/1.1 200 OK
> Date: Mon, 11 Sep 2006 23:13:10 GMT
> Server: Mongrel 0.3.13.4
> Status: 200 OK
> Cache-Control: no-cache
> Content-Type: text/html; charset=utf-8
> Vary: Accept-Encoding
> Connection: close
>
>
> > Thanks,
> > Martins
> > _______________________________________________
> > Mongrel-users mailing list
> > [email protected]
> > http://rubyforge.org/mailman/listinfo/mongrel-users
> >
>
> ===================
> Matt Pelletier
> EastMedia
> t. 212-967-4239
> f. 212-967-4257
> m. 917-902-2525
> w. www.eastmedia.com
>
>
> _______________________________________________
> Mongrel-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/mongrel-users
>
_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users