Okay, I finally managed to get rails apps running in a subdirectory of Apache using the SCGI Rails runner. However, now, none of my styles, images, or javascripts will work. I did SCGIMount /cookbook 127.0.0.1 And then I went into my routes and added cookbook/ to the front of each route that I had.in routes.rb (and now the app works!!) How do I set the default path for the stylesheets, etc?? Is there a way to set a base-path in Routes? It would appear that now that I am using the SCGIMount command, my public .htaccess rewrite rules are not working now... so the links to my style sheets and images are all pointing to /stylesheets instead of /cookbook/stylesheets, etc. Help would be very appreciated. Brian Hogan Web Development Learning & Technology Services Schofield 3-B University of Wisconsin-Eau Claire 715 836 3585 hoganbp-VnAisaAFmHY@public.gmane.org _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hi, Hogan, have you got something like: # matches locations with a dot following at least one more characters, that is, things like *,html, *.css, *.js, which should be delivered directly from the filesystem <LocationMatch \..+$> # don''t handle those with SCGI SCGIHandler Off </LocationMatch> in your VirtualHost-Directive? This would be necessary to not pass requests after .js .gif etc. files through the SCGI-Process. Doublecheck this and the other things that are documented on http://www.zedshaw.com/projects/scgi_rails/apache.html best regards Jan Prill Hogan, Brian P. wrote:> Okay, I finally managed to get rails apps running in a subdirectory of > Apache using the SCGI Rails runner. However, now, none of my styles, > images, or javascripts will work. > I did > SCGIMount /cookbook 127.0.0.1 > And then I went into my routes and added > cookbook/ > to the front of each route that I had.in routes.rb (and now the app > works!!) > How do I set the default path for the stylesheets, etc?? Is there a > way to set a base-path in Routes? It would appear that now that I am > using the SCGIMount command, my public .htaccess rewrite rules are not > working now… so the links to my style sheets and images are all > pointing to > /stylesheets instead of /cookbook/stylesheets, etc. > Help would be very appreciated. > > > Brian Hogan > Web Development > Learning & Technology Services > Schofield 3-B > University of Wisconsin-Eau Claire > 715 836 3585 > hoganbp-VnAisaAFmHY@public.gmane.org > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Hogan, Brian P. wrote:> Okay, I finally managed to get rails apps running in a subdirectory of > Apache using the SCGI Rails runner. However, now, none of my styles, > images, or javascripts will work.Have a look at http://www.zedshaw.com/projects/scgi_rails/apache.html which suggests adding the following to the Apache config for the rails host: # matches locations with a dot following at least one more characters, that is, things like *,html, *.css, *.js, which should be delivered directly from the filesystem <LocationMatch \..+$> # don''t handle those with SCGI SCGIHandler Off </LocationMatch> -- We develop, watch us RoR, in numbers too big to ignore.
Thanks, but I don''t think that''s the problem 1. I''m not using a virtual host... 2. When I look at the app in a browser and do a view-source, the paths to the stylesheets, js files, etc are pointing to ( for example) <script src="/javascripts/effects.js" type="text/javascript"></script> <script src="/javascripts/scriptaculous.js" type="text/javascript"></script> <script src="/javascripts/sortable.js" type="text/javascript"></script> They should be pointing to /cookbook/javascripts So it''s not an issue of them getting blocked, it''s an issue of how to tell Rails to look in a subfolder. Any ideas? -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jan Prill Sent: Wednesday, October 19, 2005 9:31 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! Hi, Hogan, have you got something like: # matches locations with a dot following at least one more characters, that is, things like *,html, *.css, *.js, which should be delivered directly from the filesystem <LocationMatch \..+$> # don''t handle those with SCGI SCGIHandler Off </LocationMatch> in your VirtualHost-Directive? This would be necessary to not pass requests after .js .gif etc. files through the SCGI-Process. Doublecheck this and the other things that are documented on http://www.zedshaw.com/projects/scgi_rails/apache.html best regards Jan Prill Hogan, Brian P. wrote:> Okay, I finally managed to get rails apps running in a subdirectory of > Apache using the SCGI Rails runner. However, now, none of my styles, > images, or javascripts will work. > I did > SCGIMount /cookbook 127.0.0.1 > And then I went into my routes and added > cookbook/ > to the front of each route that I had.in routes.rb (and now the app > works!!) > How do I set the default path for the stylesheets, etc?? Is there a > way to set a base-path in Routes? It would appear that now that I am > using the SCGIMount command, my public .htaccess rewrite rules are not> working now... so the links to my style sheets and images are all > pointing to > /stylesheets instead of /cookbook/stylesheets, etc. > Help would be very appreciated. > > > Brian Hogan > Web Development > Learning & Technology Services > Schofield 3-B > University of Wisconsin-Eau Claire > 715 836 3585 > hoganbp-VnAisaAFmHY@public.gmane.org > > ---------------------------------------------------------------------- > -- > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hi, Hogan, at least for stylesheet_link_tag it is possible to use absolute paths. You could try if this is working with javascript_include_tag too: javascript_include_tag "/cookbook/javascripts/effects.js" regards Jan Prill Hogan, Brian P. wrote:>Thanks, but I don''t think that''s the problem > >1. I''m not using a virtual host... >2. When I look at the app in a browser and do a view-source, the paths >to the stylesheets, js files, etc are pointing to ( for example) > ><script src="/javascripts/effects.js" type="text/javascript"></script> ><script src="/javascripts/scriptaculous.js" >type="text/javascript"></script> ><script src="/javascripts/sortable.js" type="text/javascript"></script> > >They should be pointing to /cookbook/javascripts > >So it''s not an issue of them getting blocked, it''s an issue of how to >tell Rails to look in a subfolder. > >Any ideas? > > >-----Original Message----- >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jan Prill >Sent: Wednesday, October 19, 2005 9:31 AM >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! > > >Hi, Hogan, > >have you got something like: > ># matches locations with a dot following at least one more characters, >that is, things like *,html, *.css, *.js, which should be delivered >directly from the filesystem ><LocationMatch \..+$> ># don''t handle those with SCGI >SCGIHandler Off ></LocationMatch> > >in your VirtualHost-Directive? This would be necessary to not pass >requests after .js .gif etc. files through the SCGI-Process. Doublecheck > >this and the other things that are documented on >http://www.zedshaw.com/projects/scgi_rails/apache.html > >best regards >Jan Prill > > >Hogan, Brian P. wrote: > > > >>Okay, I finally managed to get rails apps running in a subdirectory of >>Apache using the SCGI Rails runner. However, now, none of my styles, >>images, or javascripts will work. >>I did >>SCGIMount /cookbook 127.0.0.1 >>And then I went into my routes and added >>cookbook/ >>to the front of each route that I had.in routes.rb (and now the app >>works!!) >>How do I set the default path for the stylesheets, etc?? Is there a >>way to set a base-path in Routes? It would appear that now that I am >>using the SCGIMount command, my public .htaccess rewrite rules are not >> >> > > > >>working now... so the links to my style sheets and images are all >>pointing to >>/stylesheets instead of /cookbook/stylesheets, etc. >>Help would be very appreciated. >> >> >>Brian Hogan >>Web Development >>Learning & Technology Services >>Schofield 3-B >>University of Wisconsin-Eau Claire >>715 836 3585 >>hoganbp-VnAisaAFmHY@public.gmane.org >> >>---------------------------------------------------------------------- >>-- >> >>_______________________________________________ >>Rails mailing list >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Yeah, that does work, but it''s not quite where I want to go (Imagine having to modify all of your code when you deploy!) -----Original Message----- From: Jan Prill [mailto:JanPrill-sTn/vYlS8ieELgA04lAiVw@public.gmane.org] Sent: Wednesday, October 19, 2005 10:00 AM To: Hogan, Brian P. Cc: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! Hi, Hogan, at least for stylesheet_link_tag it is possible to use absolute paths. You could try if this is working with javascript_include_tag too: javascript_include_tag "/cookbook/javascripts/effects.js" regards Jan Prill Hogan, Brian P. wrote:>Thanks, but I don''t think that''s the problem > >1. I''m not using a virtual host... >2. When I look at the app in a browser and do a view-source, the paths >to the stylesheets, js files, etc are pointing to ( for example) > ><script src="/javascripts/effects.js" type="text/javascript"></script> ><script src="/javascripts/scriptaculous.js" >type="text/javascript"></script> ><script src="/javascripts/sortable.js" type="text/javascript"></script> > >They should be pointing to /cookbook/javascripts > >So it''s not an issue of them getting blocked, it''s an issue of how to >tell Rails to look in a subfolder. > >Any ideas? > > >-----Original Message----- >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jan Prill >Sent: Wednesday, October 19, 2005 9:31 AM >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! > > >Hi, Hogan, > >have you got something like: > ># matches locations with a dot following at least one more characters, >that is, things like *,html, *.css, *.js, which should be delivered >directly from the filesystem ><LocationMatch \..+$> ># don''t handle those with SCGI >SCGIHandler Off ></LocationMatch> > >in your VirtualHost-Directive? This would be necessary to not pass >requests after .js .gif etc. files through the SCGI-Process.Doublecheck> >this and the other things that are documented on >http://www.zedshaw.com/projects/scgi_rails/apache.html > >best regards >Jan Prill > > >Hogan, Brian P. wrote: > > > >>Okay, I finally managed to get rails apps running in a subdirectory of>>Apache using the SCGI Rails runner. However, now, none of my styles, >>images, or javascripts will work. I did >>SCGIMount /cookbook 127.0.0.1 >>And then I went into my routes and added >>cookbook/ >>to the front of each route that I had.in routes.rb (and now the app >>works!!) >>How do I set the default path for the stylesheets, etc?? Is there a >>way to set a base-path in Routes? It would appear that now that I am >>using the SCGIMount command, my public .htaccess rewrite rules are not >> >> > > > >>working now... so the links to my style sheets and images are all >>pointing to >>/stylesheets instead of /cookbook/stylesheets, etc. >>Help would be very appreciated. >> >> >>Brian Hogan >>Web Development >>Learning & Technology Services >>Schofield 3-B >>University of Wisconsin-Eau Claire >>715 836 3585 >>hoganbp-VnAisaAFmHY@public.gmane.org >> >>---------------------------------------------------------------------- >>-- >> >>_______________________________________________ >>Rails mailing list >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Do you need to setup a RewriteBase /cookbook/ in your .htaccess? I don''t know how/if SCGI works with that; but it''s worth looking into... On Oct 19, 2005, at 9:45 AM, Hogan, Brian P. wrote:> Thanks, but I don''t think that''s the problem > > 1. I''m not using a virtual host... > 2. When I look at the app in a browser and do a view-source, the paths > to the stylesheets, js files, etc are pointing to ( for example) > > <script src="/javascripts/effects.js" type="text/javascript"></script> > <script src="/javascripts/scriptaculous.js" > type="text/javascript"></script> > <script src="/javascripts/sortable.js" type="text/javascript"></ > script> > > They should be pointing to /cookbook/javascripts > > So it''s not an issue of them getting blocked, it''s an issue of how to > tell Rails to look in a subfolder. > > Any ideas? > > > -----Original Message----- > From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jan Prill > Sent: Wednesday, October 19, 2005 9:31 AM > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! > > > Hi, Hogan, > > have you got something like: > > # matches locations with a dot following at least one more characters, > that is, things like *,html, *.css, *.js, which should be delivered > directly from the filesystem > <LocationMatch \..+$> > # don''t handle those with SCGI > SCGIHandler Off > </LocationMatch> > > in your VirtualHost-Directive? This would be necessary to not pass > requests after .js .gif etc. files through the SCGI-Process. > Doublecheck > > this and the other things that are documented on > http://www.zedshaw.com/projects/scgi_rails/apache.html > > best regards > Jan Prill > > > Hogan, Brian P. wrote: > > >> Okay, I finally managed to get rails apps running in a >> subdirectory of >> Apache using the SCGI Rails runner. However, now, none of my styles, >> images, or javascripts will work. >> I did >> SCGIMount /cookbook 127.0.0.1 >> And then I went into my routes and added >> cookbook/ >> to the front of each route that I had.in routes.rb (and now the app >> works!!) >> How do I set the default path for the stylesheets, etc?? Is there a >> way to set a base-path in Routes? It would appear that now that I am >> using the SCGIMount command, my public .htaccess rewrite rules are >> not >> > > >> working now... so the links to my style sheets and images are all >> pointing to >> /stylesheets instead of /cookbook/stylesheets, etc. >> Help would be very appreciated. >> >> >> Brian Hogan >> Web Development >> Learning & Technology Services >> Schofield 3-B >> University of Wisconsin-Eau Claire >> 715 836 3585 >> hoganbp-VnAisaAFmHY@public.gmane.org >> >> --------------------------------------------------------------------- >> - >> -- >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I have that in my .htaccess but it appears that it is not used by the SCGI runner. This works just fine with regular CGI so I know the rewrite base is set up properly. -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Doug Alcorn Sent: Wednesday, October 19, 2005 10:08 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! Do you need to setup a RewriteBase /cookbook/ in your .htaccess? I don''t know how/if SCGI works with that; but it''s worth looking into... On Oct 19, 2005, at 9:45 AM, Hogan, Brian P. wrote:> Thanks, but I don''t think that''s the problem > > 1. I''m not using a virtual host... > 2. When I look at the app in a browser and do a view-source, the paths> to the stylesheets, js files, etc are pointing to ( for example) > > <script src="/javascripts/effects.js" type="text/javascript"></script>> <script src="/javascripts/scriptaculous.js" > type="text/javascript"></script> > <script src="/javascripts/sortable.js" type="text/javascript"></ > script> > > They should be pointing to /cookbook/javascripts > > So it''s not an issue of them getting blocked, it''s an issue of how to > tell Rails to look in a subfolder. > > Any ideas? > > > -----Original Message----- > From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jan Prill > Sent: Wednesday, October 19, 2005 9:31 AM > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! > > > Hi, Hogan, > > have you got something like: > > # matches locations with a dot following at least one more characters,> that is, things like *,html, *.css, *.js, which should be delivered > directly from the filesystem <LocationMatch \..+$> > # don''t handle those with SCGI > SCGIHandler Off > </LocationMatch> > > in your VirtualHost-Directive? This would be necessary to not pass > requests after .js .gif etc. files through the SCGI-Process. > Doublecheck > > this and the other things that are documented on > http://www.zedshaw.com/projects/scgi_rails/apache.html > > best regards > Jan Prill > > > Hogan, Brian P. wrote: > > >> Okay, I finally managed to get rails apps running in a >> subdirectory of >> Apache using the SCGI Rails runner. However, now, none of my styles, >> images, or javascripts will work. >> I did >> SCGIMount /cookbook 127.0.0.1 >> And then I went into my routes and added >> cookbook/ >> to the front of each route that I had.in routes.rb (and now the app >> works!!) >> How do I set the default path for the stylesheets, etc?? Is there a >> way to set a base-path in Routes? It would appear that now that I am >> using the SCGIMount command, my public .htaccess rewrite rules are >> not >> > > >> working now... so the links to my style sheets and images are all >> pointing to >> /stylesheets instead of /cookbook/stylesheets, etc. >> Help would be very appreciated. >> >> >> Brian Hogan >> Web Development >> Learning & Technology Services >> Schofield 3-B >> University of Wisconsin-Eau Claire >> 715 836 3585 >> hoganbp-VnAisaAFmHY@public.gmane.org >> >> --------------------------------------------------------------------->> - >> -- >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Ah, well, that would be as much as a single update of a function that you put in your application_helper.rb and use consistently in your views. But maybe someone comes up with another option. regards Jan Prill Hogan, Brian P. wrote:>Yeah, that does work, but it''s not quite where I want to go (Imagine >having to modify all of your code when you deploy!) > > > >-----Original Message----- >From: Jan Prill [mailto:JanPrill-sTn/vYlS8ieELgA04lAiVw@public.gmane.org] >Sent: Wednesday, October 19, 2005 10:00 AM >To: Hogan, Brian P. >Cc: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! > > >Hi, Hogan, > >at least for stylesheet_link_tag it is possible to use absolute paths. >You could try if this is working with javascript_include_tag too: > >javascript_include_tag "/cookbook/javascripts/effects.js" > >regards >Jan Prill > > >Hogan, Brian P. wrote: > > > >>Thanks, but I don''t think that''s the problem >> >>1. I''m not using a virtual host... >>2. When I look at the app in a browser and do a view-source, the paths >>to the stylesheets, js files, etc are pointing to ( for example) >> >><script src="/javascripts/effects.js" type="text/javascript"></script> >><script src="/javascripts/scriptaculous.js" >>type="text/javascript"></script> >><script src="/javascripts/sortable.js" type="text/javascript"></script> >> >>They should be pointing to /cookbook/javascripts >> >>So it''s not an issue of them getting blocked, it''s an issue of how to >>tell Rails to look in a subfolder. >> >>Any ideas? >> >> >>-----Original Message----- >>From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jan Prill >>Sent: Wednesday, October 19, 2005 9:31 AM >>To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! >> >> >>Hi, Hogan, >> >>have you got something like: >> >># matches locations with a dot following at least one more characters, >>that is, things like *,html, *.css, *.js, which should be delivered >>directly from the filesystem >><LocationMatch \..+$> >># don''t handle those with SCGI >>SCGIHandler Off >></LocationMatch> >> >>in your VirtualHost-Directive? This would be necessary to not pass >>requests after .js .gif etc. files through the SCGI-Process. >> >> >Doublecheck > > >>this and the other things that are documented on >>http://www.zedshaw.com/projects/scgi_rails/apache.html >> >>best regards >>Jan Prill >> >> >>Hogan, Brian P. wrote: >> >> >> >> >> >>>Okay, I finally managed to get rails apps running in a subdirectory of >>> >>> > > > >>>Apache using the SCGI Rails runner. However, now, none of my styles, >>>images, or javascripts will work. I did >>>SCGIMount /cookbook 127.0.0.1 >>>And then I went into my routes and added >>>cookbook/ >>>to the front of each route that I had.in routes.rb (and now the app >>>works!!) >>>How do I set the default path for the stylesheets, etc?? Is there a >>>way to set a base-path in Routes? It would appear that now that I am >>>using the SCGIMount command, my public .htaccess rewrite rules are not >>> >>> >>> >>> >> >> >> >> >>>working now... so the links to my style sheets and images are all >>>pointing to >>>/stylesheets instead of /cookbook/stylesheets, etc. >>>Help would be very appreciated. >>> >>> >>>Brian Hogan >>>Web Development >>>Learning & Technology Services >>>Schofield 3-B >>>University of Wisconsin-Eau Claire >>>715 836 3585 >>>hoganbp-VnAisaAFmHY@public.gmane.org >>> >>>---------------------------------------------------------------------- >>>-- >>> >>>_______________________________________________ >>>Rails mailing list >>>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >>> >>> >>_______________________________________________ >>Rails mailing list >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> >> >> > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Even though you are not using VirtualHost you probably do still need to use LocationMatch to so that Apache doesn''t try to route that stuff through SCGI. Curt On 10/19/05, Hogan, Brian P. <HOGANBP-VnAisaAFmHY@public.gmane.org> wrote:> > Yeah, that does work, but it''s not quite where I want to go (Imagine > having to modify all of your code when you deploy!) > > > > -----Original Message----- > From: Jan Prill [mailto:JanPrill-sTn/vYlS8ieELgA04lAiVw@public.gmane.org] > Sent: Wednesday, October 19, 2005 10:00 AM > To: Hogan, Brian P. > Cc: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! > > > Hi, Hogan, > > at least for stylesheet_link_tag it is possible to use absolute paths. > You could try if this is working with javascript_include_tag too: > > javascript_include_tag "/cookbook/javascripts/effects.js" > > regards > Jan Prill > > > Hogan, Brian P. wrote: > > >Thanks, but I don''t think that''s the problem > > > >1. I''m not using a virtual host... > >2. When I look at the app in a browser and do a view-source, the paths > >to the stylesheets, js files, etc are pointing to ( for example) > > > ><script src="/javascripts/effects.js" type="text/javascript"></script> > ><script src="/javascripts/scriptaculous.js" > >type="text/javascript"></script> > ><script src="/javascripts/sortable.js" type="text/javascript"></script> > > > >They should be pointing to /cookbook/javascripts > > > >So it''s not an issue of them getting blocked, it''s an issue of how to > >tell Rails to look in a subfolder. > > > >Any ideas? > > > > > >-----Original Message----- > >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jan Prill > >Sent: Wednesday, October 19, 2005 9:31 AM > >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! > > > > > >Hi, Hogan, > > > >have you got something like: > > > ># matches locations with a dot following at least one more characters, > >that is, things like *,html, *.css, *.js, which should be delivered > >directly from the filesystem > ><LocationMatch \..+$> > ># don''t handle those with SCGI > >SCGIHandler Off > ></LocationMatch> > > > >in your VirtualHost-Directive? This would be necessary to not pass > >requests after .js .gif etc. files through the SCGI-Process. > Doublecheck > > > >this and the other things that are documented on > >http://www.zedshaw.com/projects/scgi_rails/apache.html > > > >best regards > >Jan Prill > > > > > >Hogan, Brian P. wrote: > > > > > > > >>Okay, I finally managed to get rails apps running in a subdirectory of > > >>Apache using the SCGI Rails runner. However, now, none of my styles, > >>images, or javascripts will work. I did > >>SCGIMount /cookbook 127.0.0.1 <http://127.0.0.1> > >>And then I went into my routes and added > >>cookbook/ > >>to the front of each route that I had.in <http://had.in> routes.rb (and > now the app > >>works!!) > >>How do I set the default path for the stylesheets, etc?? Is there a > >>way to set a base-path in Routes? It would appear that now that I am > >>using the SCGIMount command, my public .htaccess rewrite rules are not > >> > >> > > > > > > > >>working now... so the links to my style sheets and images are all > >>pointing to > >>/stylesheets instead of /cookbook/stylesheets, etc. > >>Help would be very appreciated. > >> > >> > >>Brian Hogan > >>Web Development > >>Learning & Technology Services > >>Schofield 3-B > >>University of Wisconsin-Eau Claire > >>715 836 3585 > >>hoganbp-VnAisaAFmHY@public.gmane.org > >> > >>---------------------------------------------------------------------- > >>-- > >> > >>_______________________________________________ > >>Rails mailing list > >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >>http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > > > > > >_______________________________________________ > >Rails mailing list > >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Curt: Do you think that is the reason why the links generated by the rails application have the wrong paths? I''m using the location match generated by your InstantRails and it''s not working. SCGIMount /rproject 127.0.0.1:9999 <LocationMatch ^/(images|javascript|javascripts|stylesheets|[^/]+\.[^/]+$)> # don''t handle those with SCGI SCGIHandler Off </LocationMatch> <LocationMatch "^/$"> # don''t handle just / with SCGI SCGIHandler Off </LocationMatch> also tried SCGIMount /rproject 127.0.0.1:9999 <LocationMatch ^/rproject/(images|javascript|javascripts|stylesheets|[^/]+\.[^/]+$)> # don''t handle those with SCGI SCGIHandler Off </LocationMatch> <LocationMatch "^/$"> # don''t handle just / with SCGI SCGIHandler Off </LocationMatch> Neither one have any luck. Like I said.... rails is generating the wrong paths... I don''t think the LocationMatch thing is an issue yet... though I''m sure it will be. -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Curt Hibbs Sent: Wednesday, October 19, 2005 10:27 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! Even though you are not using VirtualHost you probably do still need to use LocationMatch to so that Apache doesn''t try to route that stuff through SCGI. Curt On 10/19/05, Hogan, Brian P. <HOGANBP-VnAisaAFmHY@public.gmane.org> wrote: Yeah, that does work, but it''s not quite where I want to go (Imagine having to modify all of your code when you deploy!) -----Original Message----- From: Jan Prill [mailto: JanPrill-sTn/vYlS8ieELgA04lAiVw@public.gmane.org <mailto:JanPrill-sTn/vYlS8ieELgA04lAiVw@public.gmane.org> ] Sent: Wednesday, October 19, 2005 10:00 AM To: Hogan, Brian P. Cc: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! Hi, Hogan, at least for stylesheet_link_tag it is possible to use absolute paths. You could try if this is working with javascript_include_tag too: javascript_include_tag "/cookbook/javascripts/effects.js" regards Jan Prill Hogan, Brian P. wrote: >Thanks, but I don''t think that''s the problem > >1. I''m not using a virtual host... >2. When I look at the app in a browser and do a view-source, the paths >to the stylesheets, js files, etc are pointing to ( for example) > ><script src="/javascripts/effects.js" type="text/javascript"></script> ><script src="/javascripts/scriptaculous.js" >type="text/javascript"></script> ><script src="/javascripts/sortable.js" type="text/javascript"></script> > >They should be pointing to /cookbook/javascripts > >So it''s not an issue of them getting blocked, it''s an issue of how to >tell Rails to look in a subfolder. > >Any ideas? > > >-----Original Message----- >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jan Prill >Sent: Wednesday, October 19, 2005 9:31 AM >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! > > >Hi, Hogan, > >have you got something like: > ># matches locations with a dot following at least one more characters, >that is, things like *,html, *.css, *.js, which should be delivered >directly from the filesystem ><LocationMatch \..+$> ># don''t handle those with SCGI >SCGIHandler Off ></LocationMatch> > >in your VirtualHost-Directive? This would be necessary to not pass >requests after .js .gif etc. files through the SCGI-Process. Doublecheck > >this and the other things that are documented on >http://www.zedshaw.com/projects/scgi_rails/apache.html > >best regards >Jan Prill > > >Hogan, Brian P. wrote: > > > >>Okay, I finally managed to get rails apps running in a subdirectory of >>Apache using the SCGI Rails runner. However, now, none of my styles, >>images, or javascripts will work. I did >>SCGIMount /cookbook 127.0.0.1 >>And then I went into my routes and added >>cookbook/ >>to the front of each route that I had.in routes.rb (and now the app >>works!!) >>How do I set the default path for the stylesheets, etc?? Is there a >>way to set a base-path in Routes? It would appear that now that I am >>using the SCGIMount command, my public .htaccess rewrite rules are not >> >> > > > >>working now... so the links to my style sheets and images are all >>pointing to >>/stylesheets instead of /cookbook/stylesheets, etc. >>Help would be very appreciated. >> >> >>Brian Hogan >>Web Development >>Learning & Technology Services >>Schofield 3-B >>University of Wisconsin-Eau Claire >>715 836 3585 >>hoganbp-VnAisaAFmHY@public.gmane.org >>>>---------------------------------------------------------------------->>-- >> >>_______________________________________________ >>Rails mailing list >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails <http://lists.rubyonrails.org/mailman/listinfo/rails> >> >> > > >_______________________________________________ >Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org <mailto:Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> >http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Since you are using subdirectories and not VirtualHost, you can''t use the root path that I had. You probably need something like: <LocationMatch ^/cookbook/(images|javascript|javascripts|stylesheets|[^/]+\.[^/]+$)> and <LocationMatch "^/cookbook/$"> Curt On 10/19/05, Hogan, Brian P. <HOGANBP-VnAisaAFmHY@public.gmane.org> wrote:> > Curt: > Do you think that is the reason why the links generated by the rails > application have the wrong paths? I''m using the location match generated by > your InstantRails and it''s not working. > SCGIMount /rproject 127.0.0.1:9999 <http://127.0.0.1:9999> > <LocationMatch > ^/(images|javascript|javascripts|stylesheets|[^/]+\.[^/]+$)> > # don''t handle those with SCGI > SCGIHandler Off > </LocationMatch> > <LocationMatch "^/$"> > # don''t handle just / with SCGI > SCGIHandler Off > </LocationMatch> > also tried > SCGIMount /rproject 127.0.0.1:9999 <http://127.0.0.1:9999> > <LocationMatch > ^/rproject/(images|javascript|javascripts|stylesheets|[^/]+\.[^/]+$)> > # don''t handle those with SCGI > SCGIHandler Off > </LocationMatch> > <LocationMatch "^/$"> > # don''t handle just / with SCGI > SCGIHandler Off > </LocationMatch> > Neither one have any luck. Like I said.... *rails* is generating the > wrong paths... I don''t think the LocationMatch thing is an issue yet... > though I''m sure it will be. > -----Original Message----- > *From:* rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto: > rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] *On Behalf Of *Curt Hibbs > *Sent:* Wednesday, October 19, 2005 10:27 AM > *To:* rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > *Subject:* Re: [Rails] SCGI Runner in a subfolder - Almost there! > > Even though you are not using VirtualHost you probably do still need to > use LocationMatch to so that Apache doesn''t try to route that stuff through > SCGI. > > Curt > > On 10/19/05, Hogan, Brian P. <HOGANBP-VnAisaAFmHY@public.gmane.org> wrote: > > > > Yeah, that does work, but it''s not quite where I want to go (Imagine > > having to modify all of your code when you deploy!) > > > > > > > > -----Original Message----- > > From: Jan Prill [mailto: JanPrill-sTn/vYlS8ieELgA04lAiVw@public.gmane.org] > > Sent: Wednesday, October 19, 2005 10:00 AM > > To: Hogan, Brian P. > > Cc: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! > > > > > > Hi, Hogan, > > > > at least for stylesheet_link_tag it is possible to use absolute paths. > > You could try if this is working with javascript_include_tag too: > > > > javascript_include_tag "/cookbook/javascripts/effects.js" > > > > regards > > Jan Prill > > > > > > Hogan, Brian P. wrote: > > > > >Thanks, but I don''t think that''s the problem > > > > > >1. I''m not using a virtual host... > > >2. When I look at the app in a browser and do a view-source, the paths > > >to the stylesheets, js files, etc are pointing to ( for example) > > > > > ><script src="/javascripts/effects.js" type="text/javascript"></script> > > ><script src="/javascripts/scriptaculous.js" > > >type="text/javascript"></script> > > ><script src="/javascripts/sortable.js" type="text/javascript"></script> > > > > > >They should be pointing to /cookbook/javascripts > > > > > >So it''s not an issue of them getting blocked, it''s an issue of how to > > >tell Rails to look in a subfolder. > > > > > >Any ideas? > > > > > > > > >-----Original Message----- > > >From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > >[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jan Prill > > >Sent: Wednesday, October 19, 2005 9:31 AM > > >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > >Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! > > > > > > > > >Hi, Hogan, > > > > > >have you got something like: > > > > > ># matches locations with a dot following at least one more characters, > > >that is, things like *,html, *.css, *.js, which should be delivered > > >directly from the filesystem > > ><LocationMatch \..+$> > > ># don''t handle those with SCGI > > >SCGIHandler Off > > ></LocationMatch> > > > > > >in your VirtualHost-Directive? This would be necessary to not pass > > >requests after .js .gif etc. files through the SCGI-Process. > > Doublecheck > > > > > >this and the other things that are documented on > > >http://www.zedshaw.com/projects/scgi_rails/apache.html > > > > > >best regards > > >Jan Prill > > > > > > > > >Hogan, Brian P. wrote: > > > > > > > > > > > >>Okay, I finally managed to get rails apps running in a subdirectory of > > > > >>Apache using the SCGI Rails runner. However, now, none of my styles, > > >>images, or javascripts will work. I did > > >>SCGIMount /cookbook 127.0.0.1 <http://127.0.0.1> > > >>And then I went into my routes and added > > >>cookbook/ > > >>to the front of each route that I had.in <http://had.in> routes.rb(and now the app > > >>works!!) > > >>How do I set the default path for the stylesheets, etc?? Is there a > > >>way to set a base-path in Routes? It would appear that now that I am > > >>using the SCGIMount command, my public .htaccess rewrite rules are not > > >> > > >> > > > > > > > > > > > >>working now... so the links to my style sheets and images are all > > >>pointing to > > >>/stylesheets instead of /cookbook/stylesheets, etc. > > >>Help would be very appreciated. > > >> > > >> > > >>Brian Hogan > > >>Web Development > > >>Learning & Technology Services > > >>Schofield 3-B > > >>University of Wisconsin-Eau Claire > > >>715 836 3585 > > >>hoganbp-VnAisaAFmHY@public.gmane.org > > >> > > >>---------------------------------------------------------------------- > > > > >>-- > > >> > > >>_______________________________________________ > > >>Rails mailing list > > >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > >> http://lists.rubyonrails.org/mailman/listinfo/rails > > >> > > >> > > > > > > > > >_______________________________________________ > > >Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > >http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> > Neither one have any luck. Like I said.... *rails* is generating the > wrong paths... I don''t think the LocationMatch thing is an issue yet... > though I''m sure it will be. >I''ve been having similar issues with non-vhost rails. Have you tried this: ActionController::Base.asset_host = ''/cookbook'' In development, I''ve been using webrick and don''t need the extra leading URI, so I have a line similar to this only in my config/environments/production.rb file. Cheers, /Nick _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hi I am trying to perform a split testing but without hacking the dispatcher.cgi. The idea is to be able to read a URL and based on that URL to have different version of a controller to execute. This way you can test different page on the same URL and see how they performed. Any idea how I could do this with Rails? Any built in functionality to do this? Thanks Manu __________________________________ Yahoo! Mail - PC Magazine Editors'' Choice 2005 http://mail.yahoo.com
Hi Brian, This is what I did to get Rails to run in a subdirectory under Apache and SCGI on linux: httpd.conf: SCGIMount /rails/app 127.0.0.1:9999 <Directory /var/www/rails/> AllowOverride All </Directory> So the mount point is a virtual subdirectory inside the rails public directory public/.htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /rails/app/$1 [QSA,L] And then in routes.rb double up each route thus: ActionController::Routing::Routes.draw do |map| base_dir = "app/" # Add your own custom routes here. # The priority is based upon order of creation: first created -> highest priority. # Here's a sample route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # You can have the root of your site routed by hooking up '' # -- just remember to delete public/index.html. map.connect '', :controller => "admin" map.connect base_dir + '', :controller => "admin" # Allow downloading Web Service WSDL as a file with an extension # instead of a file named 'wsdl' map.connect ':controller/service.wsdl', :action => 'wsdl' map.connect base_dir + ':controller/service.wsdl', :action => 'wsdl' # Install the default route as the lowest priority. map.connect ':controller/:action/:id' map.connect base_dir + ':controller/:action/:id' end So the pattern here is the same as FCGI deployment, get the webserver to check for the existance of a static file that matches the request first, if not then rewrite the request to use the SCGI mount point instead. Other than that I didn't need to set ActionController::Base.asset_host (although I spent a while trying to get it working with just that). Just ensure that the prefix route is a lower priority than the one you want to use publicly. On 19/10/05, Hogan, Brian P. <HOGANBP@uwec.edu> wrote:> > > Okay, I finally managed to get rails apps running in a subdirectory of > Apache using the SCGI Rails runner. However, now, none of my styles, images, > or javascripts will work. > > I did > > SCGIMount /cookbook 127.0.0.1 > > And then I went into my routes and added > > cookbook/ > > to the front of each route that I had.in routes.rb (and now the app > works!!) > > How do I set the default path for the stylesheets, etc?? Is there a way to > set a base-path in Routes? It would appear that now that I am using the > SCGIMount command, my public .htaccess rewrite rules are not working now… so > the links to my style sheets and images are all pointing to > > /stylesheets instead of /cookbook/stylesheets, etc. > > Help would be very appreciated._______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Paul, if I might impose on you... Would you mind to writing up instructions for this on the Instant Rails wiki? I already created a page for it: http://instantrails.rubyforge.org/wiki/wiki.pl?Running_Rails_Apps_In_Subdirectories Thanks, Curt On 10/20/05, Paul Wright <wrighty@gmail.com> wrote:> > Hi Brian, > > This is what I did to get Rails to run in a subdirectory under Apache > and SCGI on linux: > > httpd.conf: > SCGIMount /rails/app 127.0.0.1:9999 <http://127.0.0.1:9999> > <Directory /var/www/rails/> > AllowOverride All > </Directory> > > So the mount point is a virtual subdirectory inside the rails public > directory > > public/.htaccess: > RewriteEngine On > RewriteCond %{REQUEST_FILENAME} !-f > RewriteRule ^(.*)$ /rails/app/$1 [QSA,L] > > And then in routes.rb double up each route thus: > > ActionController::Routing::Routes.draw do |map| > base_dir = "app/" > > # Add your own custom routes here. > # The priority is based upon order of creation: first created -> > highest priority. > > # Here's a sample route: > # map.connect 'products/:id', :controller => 'catalog', :action => 'view' > # Keep in mind you can assign values other than :controller and :action > > # You can have the root of your site routed by hooking up '' > # -- just remember to delete public/index.html. > map.connect '', :controller => "admin" > map.connect base_dir + '', :controller => "admin" > > > # Allow downloading Web Service WSDL as a file with an extension > # instead of a file named 'wsdl' > map.connect ':controller/service.wsdl', :action => 'wsdl' > map.connect base_dir + ':controller/service.wsdl', :action => 'wsdl' > > # Install the default route as the lowest priority. > map.connect ':controller/:action/:id' > map.connect base_dir + ':controller/:action/:id' > end > > So the pattern here is the same as FCGI deployment, get the webserver > to check for the existance of a static file that matches the request > first, if not then rewrite the request to use the SCGI mount point > instead. Other than that I didn't need to set > ActionController::Base.asset_host (although I spent a while trying to > get it working with just that). Just ensure that the prefix route is > a lower priority than the one you want to use publicly. > > On 19/10/05, Hogan, Brian P. <HOGANBP@uwec.edu> wrote: > > > > > > Okay, I finally managed to get rails apps running in a subdirectory of > > Apache using the SCGI Rails runner. However, now, none of my styles, > images, > > or javascripts will work. > > > > I did > > > > SCGIMount /cookbook 127.0.0.1 <http://127.0.0.1> > > > > And then I went into my routes and added > > > > cookbook/ > > > > to the front of each route that I had.in <http://had.in> routes.rb (and > now the app > > works!!) > > > > How do I set the default path for the stylesheets, etc?? Is there a way > to > > set a base-path in Routes? It would appear that now that I am using the > > SCGIMount command, my public .htaccess rewrite rules are not working > now… so > > the links to my style sheets and images are all pointing to > > > > /stylesheets instead of /cookbook/stylesheets, etc. > > > > Help would be very appreciated. > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Paul: That didn''t work entirely. I ended up with the exact same situation I had before... The styles and js files weren''t coming through. ActionController::Base.asset_host = ''/cookbook'' I had to add that to the environment file to make the styles work. Your routes edits are spot on, as was your Here''s what I ended up doing: 1. No change to public/.htaccess (used the default that came with rails) 2. routes.rb base_dir = "cookbook/" map.connect base_dir + '':controller/:action/:id'' (I couldn''t have both routes... For some reason it was finding the wrong route when I used form submits and links... It loaded fine but navigating around the app was troublesome. I''ve decided to just change the base_dir variable when I move it around. 3. httpd.conf SCGIMount /cookbook 127.0.0.1:9999 Alias /rproject c:/rails/rails_apps/cookbook/public/ <Directory c:/rails/rails_apps/cookbook/public> AllowOverride All </Directory> <LocationMatch ^/cookbook/(images|javascript|javascripts|stylesheets|[^/]+\.[^/]+$)> # don''t handle those with SCGI SCGIHandler Off </LocationMatch> I''ll probably document this on my site later today. Thanks to everyone for their help!!! -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Paul Wright Sent: Thursday, October 20, 2005 4:01 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] SCGI Runner in a subfolder - Almost there! Hi Brian, This is what I did to get Rails to run in a subdirectory under Apache and SCGI on linux: httpd.conf: SCGIMount /rails/app 127.0.0.1:9999 <Directory /var/www/rails/> AllowOverride All </Directory> So the mount point is a virtual subdirectory inside the rails public directory public/.htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /rails/app/$1 [QSA,L] And then in routes.rb double up each route thus: ActionController::Routing::Routes.draw do |map| base_dir = "app/" # Add your own custom routes here. # The priority is based upon order of creation: first created -> highest priority. # Here''s a sample route: # map.connect ''products/:id'', :controller => ''catalog'', :action => ''view'' # Keep in mind you can assign values other than :controller and :action # You can have the root of your site routed by hooking up '''' # -- just remember to delete public/index.html. map.connect '''', :controller => "admin" map.connect base_dir + '''', :controller => "admin" # Allow downloading Web Service WSDL as a file with an extension # instead of a file named ''wsdl'' map.connect '':controller/service.wsdl'', :action => ''wsdl'' map.connect base_dir + '':controller/service.wsdl'', :action => ''wsdl'' # Install the default route as the lowest priority. map.connect '':controller/:action/:id'' map.connect base_dir + '':controller/:action/:id'' end So the pattern here is the same as FCGI deployment, get the webserver to check for the existance of a static file that matches the request first, if not then rewrite the request to use the SCGI mount point instead. Other than that I didn''t need to set ActionController::Base.asset_host (although I spent a while trying to get it working with just that). Just ensure that the prefix route is a lower priority than the one you want to use publicly. On 19/10/05, Hogan, Brian P. <HOGANBP-VnAisaAFmHY@public.gmane.org> wrote:> > > Okay, I finally managed to get rails apps running in a subdirectory of> Apache using the SCGI Rails runner. However, now, none of my styles, > images, or javascripts will work. > > I did > > SCGIMount /cookbook 127.0.0.1 > > And then I went into my routes and added > > cookbook/ > > to the front of each route that I had.in routes.rb (and now the app > works!!) > > How do I set the default path for the stylesheets, etc?? Is there a > way to set a base-path in Routes? It would appear that now that I am > using the SCGIMount command, my public .htaccess rewrite rules are not> working now... so the links to my style sheets and images are all > pointing to > > /stylesheets instead of /cookbook/stylesheets, etc. > > Help would be very appreciated.