Hi, I have a server running an apache2. I''ve decided to play around with ruby on rails, so I wanted to install rails with apache2. My first idea was to use fastcgi (mod_fastcgi), but this didn''t work at all. So I tried to get scgi_rails working: Is it right, that scgi_rails is a server managing all the requests written in ruby? the mod_scgi for apache is only for forwarding the requests of a virtualhost to the internal port of scgi_rails? I don''t understand how scgi_rails could have enough performance to manage all the requests on a often visited webpage. Apache is written in C, so I thought that managing the requests in apache and using mod_fastcgi should be faster. Can you explain why scgi_rails is fast enough and if I have understood it right, that mod_scgi is only for forwarding the requests? Well, now I''ve tried to install scgi_rails. And it is nearly working correct. But I have still a few problems, maybe you can help me: I''ve used this tutorial: http://wiki.rubyonrails.com/rails/pages/SCGI+Rails+Runner+with+Apache+2 +on+Linux This is my virtualHost: <VirtualHost myIP:80> AddDefaultCharset utf-8 ServerName myDomain DocumentRoot /srv/www/htdocs/myRailsDir/public ErrorDocument 500 /500.html ErrorDocument 404 /404.html # handle all requests throug SCGI SCGIMount /scgi-bin/ 127.0.0.1:9999 <Directory /srv/www/htdocs/myRailsDir/public> Options Indexes FollowSymLinks AllowOverride All </Directory> </VirtualHost> Can you tell me, what /scgi-bin/ is for? I changed my .htaccess and changed the dispatch.fcgi line to: RewriteRule ^(.*)$ /scgi-bin/$1 [QSA,L] Now, when calling e.g. the method "hello" of my controller "say" I get this message: Unknown action No action responded to hello.html When deleting this line from the .htaccess: RewriteRule ^([^.]+)$ $1.html [QSA] it is working. Do you know, where the problem is? And: I always have to start scgi_rails manually. Is this the right way? Or is there a chance to get apache starting the scgi_rails when it is needed? Greetings Michael
On 10/8/05, Michael Gebhart <lists-GrHYQ5MDhrHk1uMJSBkQmQ@public.gmane.org> wrote:> Hi, > > I have a server running an apache2. I''ve decided to play around with > ruby > on rails, so I wanted to install rails with apache2. My first idea was > to > use fastcgi (mod_fastcgi), but this didn''t work at all. > > So I tried to get scgi_rails working: > > Is it right, that scgi_rails is a server managing all the requests > written > in ruby? the mod_scgi for apache is only for forwarding the requests of > a > virtualhost to the internal port of scgi_rails? I don''t understand how > scgi_rails could have enough performance to manage all the requests on a > often visited webpage. Apache is written in C, so I thought that > managing > the requests in apache and using mod_fastcgi should be faster. Can you > explain why scgi_rails is fast enough and if I have understood it right, > that mod_scgi is only for forwarding the requests?SCGI manages the distribution of requests for Rails actions from Apache to the multiple rails processes that you should have running at any given time. SCGI is probably not as fast as fastcgi, but it doesn''t matter as it is not the performance bottleneck in any application..> > Well, now I''ve tried to install scgi_rails. And it is nearly working > correct. But I have still a few problems, maybe you can help me: > > I''ve used this tutorial: > http://wiki.rubyonrails.com/rails/pages/SCGI+Rails+Runner+with+Apache+2 > +on+Linux > > This is my virtualHost: > > <VirtualHost myIP:80> > AddDefaultCharset utf-8 > ServerName myDomain > DocumentRoot /srv/www/htdocs/myRailsDir/public > ErrorDocument 500 /500.html > ErrorDocument 404 /404.html > # handle all requests throug SCGI > > SCGIMount /scgi-bin/ 127.0.0.1:9999 > > <Directory /srv/www/htdocs/myRailsDir/public> > Options Indexes FollowSymLinks > AllowOverride All > </Directory> > </VirtualHost> > > Can you tell me, what /scgi-bin/ is for?scgi-bin is a virtual folder. Any requests that come to yourserver.com/scgi-bin/.* will be routed to an scgi handler.> > I changed my .htaccess and changed the dispatch.fcgi line to: > > RewriteRule ^(.*)$ /scgi-bin/$1 [QSA,L]This rule makes any request that doesn''t hit a file in your public folder reroute to the scgi-bin, so that it gets handled by scgi.> > Now, when calling e.g. the method "hello" of my controller "say" I get > this message: > > > Unknown action > No action responded to hello.html > > When deleting this line from the .htaccess: > > RewriteRule ^([^.]+)$ $1.html [QSA] > > it is working. > > Do you know, where the problem is? >I never really understood why that line was in the .htaccess to begin with. Tossing it out should be fine.> > And: I always have to start scgi_rails manually. Is this the right way? > Or > is there a chance to get apache starting the scgi_rails when it is > needed?The scgi server is independent of apache. If you want to start them both together, write a shell script.> > Greetings > > Michael > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Hi, first thanks for your answer.> SCGI manages the distribution of requests for Rails actions from > Apache to the multiple rails processes that you should have running at > any given time. SCGI is probably not as fast as fastcgi, but it > doesn''t matter as it is not the performance bottleneck in any > application..But?> scgi-bin is a virtual folder. Any requests that come to > yourserver.com/scgi-bin/.* will be routed to an scgi handler.Ah oki. But then I don''t need the .htaccess in my public folder right? Because it will be never used. Every request will be sent to the scgi_handler. So the .htaccess is never used.> > This rule makes any request that doesn''t hit a file in your public > folder reroute to the scgi-bin, so that it gets handled by scgi.Ok, but I don''t need the whole .htaccess file in my opinion. Do I need the dispatch-files any longer? Are they used by scgi_rails?> The scgi server is independent of apache. If you want to start them > both together, write a shell script.Oki, thanks! Michael
On 10/8/05, Michael Gebhart <lists-GrHYQ5MDhrHk1uMJSBkQmQ@public.gmane.org> wrote:> Hi, > > first thanks for your answer. > > > SCGI manages the distribution of requests for Rails actions from > > Apache to the multiple rails processes that you should have running at > > any given time. SCGI is probably not as fast as fastcgi, but it > > doesn''t matter as it is not the performance bottleneck in any > > application.. > > But?The two periods were a typo, not an ellipsis> > > > scgi-bin is a virtual folder. Any requests that come to > > yourserver.com/scgi-bin/.* will be routed to an scgi handler. > > Ah oki. But then I don''t need the .htaccess in my public folder right? > Because it will be never used. Every request will be sent to the > scgi_handler. So the .htaccess is never used.You still need the .htaccess to filter out the public/ files from the rails requests. Its also useful for blocking subdirectories, setting HTTP authentication, etc..> > > > This rule makes any request that doesn''t hit a file in your public > > folder reroute to the scgi-bin, so that it gets handled by scgi. > > Ok, but I don''t need the whole .htaccess file in my opinion. Do I need > the dispatch-files any longer? Are they used by scgi_rails?You don''t need the dispatch files..> > > The scgi server is independent of apache. If you want to start them > > both together, write a shell script. > > Oki, thanks! > > Michael > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I was puzzled by this too...guess it''s for cache_page function that it tries to check if there a cached page for that request. But if so, it doesn''t work for other kind of cache like images from db.> > Unknown action > > No action responded to hello.html > > > > When deleting this line from the .htaccess: > > > > RewriteRule ^([^.]+)$ $1.html [QSA] > > > > it is working. > > > > Do you know, where the problem is? > > > > I never really understood why that line was in the .htaccess to begin > with. Tossing it out should be fine.
Hi,> You still need the .htaccess to filter out the public/ files from the > rails requests. Its also useful for blocking subdirectories, setting > HTTP authentication, etc..<VirtualHost 217.172.179.110:80> ServerName rails.mydomain.xy DocumentRoot /srv/www/htdocs/pathToRails/public ErrorDocument 500 /500.html ErrorDocument 404 /404.html SCGIMount / 127.0.0.1:9999 <LocationMatch \..+$> # don''t handle those with SCGI SCGIHandler Off </LocationMatch> <Directory /srv/www/htdocs/pathToRails/public> DirectoryIndex index.html Options +FollowSymLinks Order allow,deny allow from all </Directory> </VirtualHost> This is my current VirtualHost. When using the .htaccess I can''t call rails.mydomain.xy/ and get the index.html displayed. rails.mydomain.xy/index.html is working, but when simply calling rails.mydomain.xy I get this: Routing Error Recognition failed for "/" Without the .htaccess it is working. AddHandler fastcgi-script .fcgi AddHandler cgi-script .cgi Options +FollowSymLinks +ExecCGI These lines aren''t needed in .htaccess, right? Because I use scgi_rails. http://wiki.rubyonrails.com/rails/pages/SCGI+Rails+Runner+with+Apache+2 +on+Linux says I should change the routes.rb. But when having my rails dir in / I don''t need any changes, or do I have to change it although? Greetings Michael
You still need to double up your routes to avoid having scgi-bin visible as a part of your urls. On 10/8/05, Michael Gebhart <lists-GrHYQ5MDhrHk1uMJSBkQmQ@public.gmane.org> wrote:> Hi, > > > > You still need the .htaccess to filter out the public/ files from the > > rails requests. Its also useful for blocking subdirectories, setting > > HTTP authentication, etc.. > > <VirtualHost 217.172.179.110:80> > ServerName rails.mydomain.xy > DocumentRoot /srv/www/htdocs/pathToRails/public > ErrorDocument 500 /500.html > ErrorDocument 404 /404.html > > SCGIMount / 127.0.0.1:9999 > > <LocationMatch \..+$> > # don''t handle those with SCGI > SCGIHandler Off > </LocationMatch> > <Directory /srv/www/htdocs/pathToRails/public> > DirectoryIndex index.html > Options +FollowSymLinks > Order allow,deny > allow from all > </Directory> > </VirtualHost> > > This is my current VirtualHost. When using the .htaccess I can''t call > rails.mydomain.xy/ and get the index.html displayed. > rails.mydomain.xy/index.html is working, but when simply calling > rails.mydomain.xy I get this: > > Routing Error > Recognition failed for "/" > > > Without the .htaccess it is working. > > > AddHandler fastcgi-script .fcgi > AddHandler cgi-script .cgi > Options +FollowSymLinks +ExecCGI > > These lines aren''t needed in .htaccess, right? Because I use scgi_rails. > > > http://wiki.rubyonrails.com/rails/pages/SCGI+Rails+Runner+with+Apache+2 > +on+Linux > > says I should change the routes.rb. But when having my rails dir in / I > don''t need any changes, or do I have to change it although? > > Greetings > > Michael > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Hi again, now I''ve got it working. But in another way: I had to delete the htaccess, because I didn''t get it to work here :) So, this is my current VirtualHost: <VirtualHost 217.172.179.110:80> ServerName rails.mydomain.xy DocumentRoot /srv/www/htdocs/pathToRails/public ErrorDocument 500 /500.html ErrorDocument 404 /404.html SCGIMount / 127.0.0.1:9999 <LocationMatch \..+$> # don''t handle those with SCGI SCGIHandler Off </LocationMatch> <LocationMatch "^/$"> SCGIHandler Off </LocationMatch> <Directory /srv/www/htdocs/pathToRails/public> DirectoryIndex index.html Options +FollowSymLinks Order allow,deny allow from all </Directory> </VirtualHost> If a file contains a . (dot) or if the location is /, then the SCGI Handler is disabled. So rails.mydomain.xy/ displays the index.html, each file with a dot is handled without scgi and everything else is handled by scgi_rails. I think this should do the same as the .htaccess file. If not, I should try it again with the way, the wiki on rubyonrails does it. Greetings Mike> You still need to double up your routes to avoid having scgi-bin > visible as a part of your urls. > > On 10/8/05, Michael Gebhart <lists-GrHYQ5MDhrHk1uMJSBkQmQ@public.gmane.org> wrote: > > Hi, > > > > > > > You still need the .htaccess to filter out the public/ files from the > > > rails requests. Its also useful for blocking subdirectories, setting > > > HTTP authentication, etc.. > > > > <VirtualHost 217.172.179.110:80> > > ServerName rails.mydomain.xy > > DocumentRoot /srv/www/htdocs/pathToRails/public > > ErrorDocument 500 /500.html > > ErrorDocument 404 /404.html > > > > SCGIMount / 127.0.0.1:9999 > > > > <LocationMatch \..+$> > > # don''t handle those with SCGI > > SCGIHandler Off > > </LocationMatch> > > <Directory /srv/www/htdocs/pathToRails/public> > > DirectoryIndex index.html > > Options +FollowSymLinks > > Order allow,deny > > allow from all > > </Directory> > > </VirtualHost> > > > > This is my current VirtualHost. When using the .htaccess I can''t call > > rails.mydomain.xy/ and get the index.html displayed. > > rails.mydomain.xy/index.html is working, but when simply calling > > rails.mydomain.xy I get this: > > > > Routing Error > > Recognition failed for "/" > > > > > > Without the .htaccess it is working. > > > > > > AddHandler fastcgi-script .fcgi > > AddHandler cgi-script .cgi > > Options +FollowSymLinks +ExecCGI > > > > These lines aren''t needed in .htaccess, right? Because I use scgi_rails. > > > > > > http://wiki.rubyonrails.com/rails/pages/SCGI+Rails+Runner+with+Apache+2 > > +on+Linux > > > > says I should change the routes.rb. But when having my rails dir in / I > > don''t need any changes, or do I have to change it although? > > > > Greetings > > > > Michael > > > > _______________________________________________ > > 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 >