hemant
2006-Sep-07 10:44 UTC
[Mongrel] what should be correct .conf file for being served by apache for static content
Recently while i turned on USR1 debugging...mongrel running behind Apache2.2threw following debugging messages: Thu Sep 07 15:58:30 IST 2006: 0 threads sync_waiting for /charts/%5EBSESN, 1 still active in mongrel. Thu Sep 07 15:58:40 IST 2006: 0 threads sync_waiting for /images/tab_but_normal1.png, 3 still active in mongrel. Thu Sep 07 15:58:40 IST 2006: 0 threads sync_waiting for /images/msgBg1.gif, 3 still active in mongrel. Thu Sep 07 15:58:40 IST 2006: 0 threads sync_waiting for /images/flash/video/BloomBerg.jpg, 1 still active in mongrel. Now..Zed earlier...pointed that, why the hell..your mongrel is serving static content.Well, thankfully earlier logs were from mongrel running standalone in development mode. But how about the above? why I am still getting these logs? Are my static pages served by mongrel: <VirtualHost *:80>> ServerAdmin webmaster at dummy-host.example.com > DocumentRoot /var/www/ubac_webfront/public > ServerName foobar.com > ServerAlias *.foobar.com > <Directory /var/www/ubac_webfront/public> > Options FollowSymLinks > AllowOverride None > Order allow,deny > Allow from all > </Directory> > RewriteEngine On > > # Make sure people go to www.myapp.com, not myapp.com > RewriteCond %{HTTP_HOST} ^foobar.com$ [NC] > RewriteRule ^(.*)$ http://www.foobar.com$1 [R=301,L] > # Yes, I''ve read no-www.com, but my site already has much Google-Fu on > # www.blah.com. Feel free to comment this out. > > # Uncomment for rewrite debugging > #RewriteLog logs/myapp_rewrite_log > #RewriteLogLevel 9 > > # 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://mongrel_cluster%{REQUEST_URI} [P,QSA,L] > > # Deflate > AddOutputFilterByType DEFLATE text/html text/plain text/xml > application/xml application/xhtml+xml text/javascript text/css > BrowserMatch ^Mozilla/4 gzip-only-text/html > BrowserMatch ^Mozilla/4.0[678] no-gzip > BrowserMatch bMSIE !no-gzip !gzip-only-text/html > # Uncomment for deflate debugging > #DeflateFilterNote Input input_info > #DeflateFilterNote Output output_info > #DeflateFilterNote Ratio ratio_info > #LogFormat ''"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)'' > deflate > #CustomLog logs/myapp_deflate_log deflate > </VirtualHost>It is just a copy and paste of coda and philip''s configurations. -- nothing much to talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060907/fda8ec16/attachment.html
Brett Walker
2006-Sep-07 12:37 UTC
[Mongrel] what should be correct .conf file for being served by apache for static content
Hemant, I went through this same issue a couple of days ago. I had it configured just like you do, and thought Apache was serving the static files. Took me half a day to figure out the problem. My problem ended up being the permissions on the base directory. Was serving my app from a subdir in my home directory, and it didn''t have the correct permission for the apache process to read it. I did a chmod 755 /home/myuser and suddenly Apache could server the static files. Also, if you stop Mongrel, then try to serve one of your static files, you can tell for sure whether Apache is serving it or not. Cheers, Brett On 9/7/06, hemant <gethemant at gmail.com> wrote:> Recently while i turned on USR1 debugging...mongrel running behind Apache2.2 > threw following debugging messages: > > Thu Sep 07 15:58:30 IST 2006: 0 threads sync_waiting for /charts/%5EBSESN, 1 > still active in mongrel. > Thu Sep 07 15:58:40 IST 2006: 0 threads sync_waiting for > /images/tab_but_normal1.png, 3 still active in mongrel. > Thu Sep 07 15:58:40 IST 2006: 0 threads sync_waiting for /images/msgBg1.gif, > 3 still active in mongrel. > Thu Sep 07 15:58:40 IST 2006: 0 threads sync_waiting for > /images/flash/video/BloomBerg.jpg, 1 still active in > mongrel. > > > Now..Zed earlier...pointed that, why the hell..your mongrel is serving > static content.Well , thankfully earlier logs were from mongrel running > standalone in development mode. > But how about the above? why I am still getting these logs? Are my static > pages served by mongrel: > > > > <VirtualHost *:80> > > ServerAdmin webmaster at dummy-host.example.com > > DocumentRoot /var/www/ubac_webfront/public > > ServerName foobar.com > > ServerAlias *.foobar.com > > <Directory /var/www/ubac_webfront/public> > > Options FollowSymLinks > > AllowOverride None > > Order allow,deny > > Allow from all > > </Directory> > > RewriteEngine On > > > > # Make sure people go to www.myapp.com, not myapp.com > > RewriteCond %{HTTP_HOST} ^foobar.com$ [NC] > > RewriteRule ^(.*)$ http://www.foobar.com$1 [R=301,L] > > # Yes, I''ve read no-www.com, but my site already has much Google-Fu on > > # www.blah.com. Feel free to comment this out. > > > > # Uncomment for rewrite debugging > > #RewriteLog logs/myapp_rewrite_log > > #RewriteLogLevel 9 > > > > # 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://mongrel_cluster%{REQUEST_URI} [P,QSA,L] > > > > # Deflate > > AddOutputFilterByType DEFLATE text/html text/plain text/xml > application/xml application/xhtml+xml text/javascript text/css > > BrowserMatch ^Mozilla/4 gzip-only-text/html > > BrowserMatch ^Mozilla/4.0[678] no-gzip > > BrowserMatch bMSIE !no-gzip !gzip-only-text/html > > # Uncomment for deflate debugging > > #DeflateFilterNote Input input_info > > #DeflateFilterNote Output output_info > > #DeflateFilterNote Ratio ratio_info > > #LogFormat ''"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)'' > deflate > > #CustomLog logs/myapp_deflate_log deflate > > </VirtualHost> > > It is just a copy and paste of coda and philip''s configurations. > > -- > nothing much to talk > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users > >
Zed Shaw
2006-Sep-07 13:00 UTC
[Mongrel] what should be correct .conf file for being served by apache for static content
On Thu, 2006-09-07 at 20:37 +0800, Brett Walker wrote:> Hemant, > > I went through this same issue a couple of days ago. I had it > configured just like you do, and thought Apache was serving the static > files. Took me half a day to figure out the problem. > > My problem ended up being the permissions on the base directory. Was > serving my app from a subdir in my home directory, and it didn''t have > the correct permission for the apache process to read it. I did a > > chmod 755 /home/myuser > > and suddenly Apache could server the static files. > > Also, if you stop Mongrel, then try to serve one of your static files, > you can tell for sure whether Apache is serving it or not.Hmmm, I might add that to the FAQ. Weird that apache wouldn''t consider that an error. -- Zed A. Shaw http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.
Brett Walker
2006-Sep-07 13:21 UTC
[Mongrel] what should be correct .conf file for being served by apache for static content
Well, I was getting a ''(13)Permission denied: '', but the permissions on my rails directory were fine. It was one of the parent directories that were wrong, and it took me awhile to figure that out. Maybe I''m just too much of a newbie. On 9/7/06, Zed Shaw <zedshaw at zedshaw.com> wrote:> On Thu, 2006-09-07 at 20:37 +0800, Brett Walker wrote: > > Hemant, > > > > I went through this same issue a couple of days ago. I had it > > configured just like you do, and thought Apache was serving the static > > files. Took me half a day to figure out the problem. > > > > My problem ended up being the permissions on the base directory. Was > > serving my app from a subdir in my home directory, and it didn''t have > > the correct permission for the apache process to read it. I did a > > > > chmod 755 /home/myuser > > > > and suddenly Apache could server the static files. > > > > Also, if you stop Mongrel, then try to serve one of your static files, > > you can tell for sure whether Apache is serving it or not. > > Hmmm, I might add that to the FAQ. Weird that apache wouldn''t consider > that an error. > > > -- > Zed A. Shaw > http://www.zedshaw.com/ > http://mongrel.rubyforge.org/ > http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help. > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >
hemant
2006-Sep-09 13:14 UTC
[Mongrel] what should be correct .conf file for being served by apache for static content
"Also, if you stop Mongrel, then try to serve one of your static files, you can tell for sure whether Apache is serving it or not" To all those folks out there...who are using ProxyPass and ProxyPassReverse statements for forwarding requests to the proxy....the above tests fails, and hence....I am not sure, if Apache serves static pages, if you are using ProxyPass and ProxyPassReverse. On 9/7/06, Brett Walker <lapomme00 at gmail.com> wrote:> > Well, I was getting a ''(13)Permission denied: '', but the permissions > on my rails directory were fine. It was one of the parent directories > that were wrong, and it took me awhile to figure that out. Maybe I''m > just too much of a newbie. > > On 9/7/06, Zed Shaw <zedshaw at zedshaw.com> wrote: > > On Thu, 2006-09-07 at 20:37 +0800, Brett Walker wrote: > > > Hemant, > > > > > > I went through this same issue a couple of days ago. I had it > > > configured just like you do, and thought Apache was serving the static > > > files. Took me half a day to figure out the problem. > > > > > > My problem ended up being the permissions on the base directory. Was > > > serving my app from a subdir in my home directory, and it didn''t have > > > the correct permission for the apache process to read it. I did a > > > > > > chmod 755 /home/myuser > > > > > > and suddenly Apache could server the static files. > > > > > > Also, if you stop Mongrel, then try to serve one of your static files, > > > you can tell for sure whether Apache is serving it or not. > > > > Hmmm, I might add that to the FAQ. Weird that apache wouldn''t consider > > that an error. > > > > > > -- > > Zed A. Shaw > > http://www.zedshaw.com/ > > http://mongrel.rubyforge.org/ > > http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help. > > > > _______________________________________________ > > Mongrel-users mailing list > > Mongrel-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/mongrel-users > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >-- nothing much to talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060909/ad213411/attachment.html
Jens Kraemer
2006-Sep-09 13:36 UTC
[Mongrel] what should be correct .conf file for being served by apache for static content
On Sat, Sep 09, 2006 at 06:44:13PM +0530, hemant wrote:> "Also, if you stop Mongrel, then try to serve one of your static files, > you can tell for sure whether Apache is serving it or not" > > To all those folks out there...who are using ProxyPass and ProxyPassReverse > statements for forwarding requests to the proxy....the above tests fails, > and hence....I am not sure, if Apache serves static pages, if you are using > ProxyPass and ProxyPassReverse.Yep. To conditionally forward requests to Mongrel you should use url rewrite rules instead of ProxyPass* directives: # 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 # translated: "if this request does not point to a file we have lying # around in our file system (the !-f part), then go ahead and let #Mongrel do it''s job" RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] You can achieve the same with the Proxy* rules by explicitly excluding several directories where static files reside from being proxied, but the rewrite approach is much more elegant, imho. The snippet has been taken from the quite complex apache config example at http://mongrel.rubyforge.org/docs/apache.html Jens -- webit! Gesellschaft f?r neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66
hemant
2006-Sep-09 13:52 UTC
[Mongrel] what should be correct .conf file for being served by apache for static content
<snip> # Redirect all non-static requests to cluster> # translated: "if this request does not point to a file we have lying > # around in our file system (the !-f part), then go ahead and let > #Mongrel do it''s job" > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] > > You can achieve the same with the Proxy* rules by explicitly excluding > several directories where static files reside from being proxied, but > the rewrite approach is much more elegant, imho. > > The snippet has been taken from the quite complex apache config example > at http://mongrel.rubyforge.org/docs/apache.html > > </snip>Yes...i am using that. But as I have seen ProxyPass and ProxyPassReverse rules..being used(or at least, quoted as being used by so many bloggers), I wanted to point this out. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060909/3e769c74/attachment.html
Tom Brice
2006-Sep-09 20:06 UTC
[Mongrel] what should be correct .conf file for being served by apache for static content
On 9/9/06 8:36 AM, Jens Kraemer wrote:> To conditionally forward requests to Mongrel you should use url > rewrite rules instead of ProxyPass* directives: > > # 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 > # translated: "if this request does not point to a file we have lying > # around in our file system (the !-f part), then go ahead and let > #Mongrel do it''s job" > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] > > You can achieve the same with the Proxy* rules by explicitly excluding > several directories where static files reside from being proxied, but > the rewrite approach is much more elegant, imho. > > The snippet has been taken from the quite complex apache config example > at http://mongrel.rubyforge.org/docs/apache.htmlJens, Just wanted to thank you for annotating this. Very helpful to know how these rules work. Tom
Bob Hutchison
2006-Sep-10 13:17 UTC
[Mongrel] what should be correct .conf file for being served by apache for static content
On Sep 9, 2006, at 9:14 AM, hemant wrote:> "Also, if you stop Mongrel, then try to serve one of your static > files, > you can tell for sure whether Apache is serving it or not" > > To all those folks out there...who are using ProxyPass and > ProxyPassReverse > statements for forwarding requests to the proxy....the above tests > fails, > and hence....I am not sure, if Apache serves static pages, if you > are using > ProxyPass and ProxyPassReverse.Hmm. It works for me. Cheers, Bob ---- Bob Hutchison -- blogs at <http://www.recursive.ca/ hutch/> Recursive Design Inc. -- <http://www.recursive.ca/> Raconteur -- <http://www.raconteur.info/> xampl for Ruby -- <http://rubyforge.org/projects/xampl/> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060910/70bf11f4/attachment.html