Hi everyone, I''m having a problem getting instant rails working well on apache. I created an alias that points to the apps'' public directory and it works, but when I access my application it take a long long time. Over 3 minutes sometimes. But it does always work, just painfully slow. I think it has to do with scgi but I''m unsure how to speed it up. In WEBricks it works really well and quickly. Can anyone help me out? (I can post my config files if needed.) Thanks, Bram -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/instantrails-users/attachments/20060606/460aa1b5/attachment.htm
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Axiom Dadak wrote:> Hi everyone, > > I''m having a problem getting instant rails working well on apache. > > I created an alias that points to the apps'' public directory and it > works, but when I access my application it take a long long time. Over > 3 minutes sometimes. But it does always work, just painfully slow. I > think it has to do with scgi but I''m unsure how to speed it up.A rails application usually expects to run as a virtual host, not as a subdirectory, which is what an alias will do. To make it work, you need to edit the .htaccess file to include the new path, and maybe some other hacks. Something about a routing prefix.... Some links I turned up... http://wiki.rubyonrails.com/rails/pages/HowToSetTheBaseURLsOfYourRailsApps http://wiki.rubyonrails.com/rails/pages/HowtoDeployMoreThanOneRailsAppOnOneMachine - -- David Morton Maia Mailguard - http://www.maiamailguard.com Morton Software Design and Consulting - http://www.dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEhk/RUy30ODPkzl0RAhB5AKDPHbMlCxW0O1/MclYJhPpoM5H4PQCggqtq gzBzoBrdob0Xae/ZqNeECl0=B0un -----END PGP SIGNATURE-----
Hi, Thanks for the links, but they don''t solve the problem. I would run it as a virtual host, but I''m working off other people''s computers and I don''t want to have to edit the hosts file. I''ve already got it working, it''s just really really slow. I''m pretty sure it''s an SCGI thing. Here''s my setup: apache - httpd.conf Alias /scotch/ "${path}/rails_apps/scotch/public/" SCGIMount /dispatch.fcgi 127.0.0.1:9997 <Directory "${path}/rails_apps/scotch/public"> Options ExecCGI Options +FollowSymLinks Order allow,deny allow from all </Directory> And the .htaccess file in the public directory of my application, I''ve kept as as default but added this: RewriteBase /scotch Like I said, it works, but takes 2 mins to load each page. I think it''s not using SCGI, since I don''t even need to have the SCGI server running for it to work. Thanks again, Bram On 6/7/06, David Morton <mortonda at dgrmm.net> wrote:> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Axiom Dadak wrote: > > Hi everyone, > > > > I''m having a problem getting instant rails working well on apache. > > > > I created an alias that points to the apps'' public directory and it > > works, but when I access my application it take a long long time. Over > > 3 minutes sometimes. But it does always work, just painfully slow. I > > think it has to do with scgi but I''m unsure how to speed it up. > > A rails application usually expects to run as a virtual host, not as a > subdirectory, which is what an alias will do. > > To make it work, you need to edit the .htaccess file to include the new > path, > and maybe some other hacks. Something about a routing prefix.... > > Some links I turned up... > > http://wiki.rubyonrails.com/rails/pages/HowToSetTheBaseURLsOfYourRailsApps > > http://wiki.rubyonrails.com/rails/pages/HowtoDeployMoreThanOneRailsAppOnOneMachine > > - -- > David Morton > Maia Mailguard - http://www.maiamailguard.com > Morton Software Design and Consulting - http://www.dgrmm.net > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.2.2 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFEhk/RUy30ODPkzl0RAhB5AKDPHbMlCxW0O1/MclYJhPpoM5H4PQCggqtq > gzBzoBrdob0Xae/ZqNeECl0> =B0un > -----END PGP SIGNATURE----- > _______________________________________________ > Instantrails-users mailing list > Instantrails-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/instantrails-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/instantrails-users/attachments/20060607/e2a374df/attachment-0001.htm
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Axiom Dadak wrote:> Like I said, it works, but takes 2 mins to load each page. I think it''s > not using SCGI, since I don''t even need to have the SCGI server running > for it to work.yeah, that sounds exactly right; the rewrite isn''t matching the new urls. I''m a bit busy to look into it more deeply, but if I remember right, there is some difficulty with getting the rewrite to work. - -- David Morton Maia Mailguard - http://www.maiamailguard.com Morton Software Design and Consulting - http://www.dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEhx6LUy30ODPkzl0RAiTxAJoCazhSyvt0T16zmXwEWa2BEUAaugCfWdxe LXTNX4uDVyqvWiK0TgPKp5w=ZIR5 -----END PGP SIGNATURE-----
Ok, I solved it! It took a lot of playing around, but I''ve got it working now. This is how you setup a rails application in apache using aliases and SCGI: (in this case, my application is called scotch and it usses port 9997) httpd.conf -> Alias /scotch/ "${path}/rails_apps/scotch/public/" SCGIMount /scotch/dispatch.fcgi 127.0.0.1:9997 <Directory "${path}/rails_apps/scotch/public"> Options ExecCGI Options +FollowSymLinks Order allow,deny allow from all </Directory> Then in the .htaccess file in the application''s public directory -> AddHandler fastcgi-script .fcgi AddHandler cgi-script .cgi Options +FollowSymLinks +ExecCGI RewriteEngine On RewriteBase /scotch RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /scotch/dispatch.fcgi/$1 [QSA,L] ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly" Then, when you''re ready to run your application, start the SCGI server through the "instantrails->manage applications" control pannel. And it works great! I''ll be posting this to the wiki soon. Bram On 6/7/06, David Morton <mortonda at dgrmm.net> wrote:> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Axiom Dadak wrote: > > > Like I said, it works, but takes 2 mins to load each page. I think it''s > > not using SCGI, since I don''t even need to have the SCGI server running > > for it to work. > > yeah, that sounds exactly right; the rewrite isn''t matching the new > urls. I''m a > bit busy to look into it more deeply, but if I remember right, there is > some > difficulty with getting the rewrite to work. > > > - -- > David Morton > Maia Mailguard - http://www.maiamailguard.com > Morton Software Design and Consulting - http://www.dgrmm.net > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.2.2 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFEhx6LUy30ODPkzl0RAiTxAJoCazhSyvt0T16zmXwEWa2BEUAaugCfWdxe > LXTNX4uDVyqvWiK0TgPKp5w> =ZIR5 > -----END PGP SIGNATURE----- > _______________________________________________ > Instantrails-users mailing list > Instantrails-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/instantrails-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/instantrails-users/attachments/20060607/a1488249/attachment.htm
Excellent! Can you add instructions for this on the Instant Raiks wiki? Thanks, Curt On 6/7/06, Axiom Dadak <axiomdadak at gmail.com> wrote:> > Ok, I solved it! > > It took a lot of playing around, but I''ve got it working now. > > This is how you setup a rails application in apache using aliases and > SCGI: > > (in this case, my application is called scotch and it usses port 9997) > > httpd.conf -> > > Alias /scotch/ "${path}/rails_apps/scotch/public/" > SCGIMount /scotch/dispatch.fcgi 127.0.0.1:9997 > > <Directory "${path}/rails_apps/scotch/public"> > Options ExecCGI > Options +FollowSymLinks > Order allow,deny > allow from all > </Directory> > > Then in the .htaccess file in the application''s public directory -> > > AddHandler fastcgi-script .fcgi > AddHandler cgi-script .cgi > Options +FollowSymLinks +ExecCGI > RewriteEngine On > RewriteBase /scotch > RewriteRule ^$ index.html [QSA] > RewriteRule ^([^.]+)$ $1.html [QSA] > RewriteCond %{REQUEST_FILENAME} !-f > RewriteRule ^(.*)$ /scotch/dispatch.fcgi/$1 [QSA,L] > ErrorDocument 500 "<h2>Application error</h2>Rails application failed to > start properly" > > Then, when you''re ready to run your application, start the SCGI server > through the "instantrails->manage applications" control pannel. > > And it works great! > > I''ll be posting this to the wiki soon. > > Bram > > On 6/7/06, David Morton <mortonda at dgrmm.net> wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Axiom Dadak wrote: > > > > > Like I said, it works, but takes 2 mins to load each page. I think > > it''s > > > not using SCGI, since I don''t even need to have the SCGI server > > running > > > for it to work. > > > > yeah, that sounds exactly right; the rewrite isn''t matching the new > > urls. I''m a > > bit busy to look into it more deeply, but if I remember right, there is > > some > > difficulty with getting the rewrite to work. > > > > > > - -- > > David Morton > > Maia Mailguard - http://www.maiamailguard.com > > Morton Software Design and Consulting - http://www.dgrmm.net > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.2.2 (GNU/Linux) > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > > > iD8DBQFEhx6LUy30ODPkzl0RAiTxAJoCazhSyvt0T16zmXwEWa2BEUAaugCfWdxe > > LXTNX4uDVyqvWiK0TgPKp5w> > =ZIR5 > > -----END PGP SIGNATURE----- > > _______________________________________________ > > Instantrails-users mailing list > > Instantrails-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/instantrails-users > > > > > _______________________________________________ > Instantrails-users mailing list > Instantrails-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/instantrails-users > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/instantrails-users/attachments/20060607/33a749ba/attachment.htm
Already done and there is a link to it from the FAQ. On 6/7/06, Curt Hibbs <curt.hibbs at gmail.com> wrote:> > Excellent! Can you add instructions for this on the Instant Raiks wiki? > > Thanks, > Curt > > > On 6/7/06, Axiom Dadak < axiomdadak at gmail.com> wrote: > > > > Ok, I solved it! > > > > It took a lot of playing around, but I''ve got it working now. > > > > This is how you setup a rails application in apache using aliases and > > SCGI: > > > > (in this case, my application is called scotch and it usses port 9997) > > > > httpd.conf -> > > > > Alias /scotch/ "${path}/rails_apps/scotch/public/" > > SCGIMount /scotch/dispatch.fcgi 127.0.0.1:9997 > > > > <Directory "${path}/rails_apps/scotch/public"> > > Options ExecCGI > > Options +FollowSymLinks > > Order allow,deny > > allow from all > > </Directory> > > > > Then in the .htaccess file in the application''s public directory -> > > > > AddHandler fastcgi-script .fcgi > > AddHandler cgi-script .cgi > > Options +FollowSymLinks +ExecCGI > > RewriteEngine On > > RewriteBase /scotch > > RewriteRule ^$ index.html [QSA] > > RewriteRule ^([^.]+)$ $1.html [QSA] > > RewriteCond %{REQUEST_FILENAME} !-f > > RewriteRule ^(.*)$ /scotch/dispatch.fcgi/$1 [QSA,L] > > ErrorDocument 500 "<h2>Application error</h2>Rails application failed to > > start properly" > > > > Then, when you''re ready to run your application, start the SCGI server > > through the "instantrails->manage applications" control pannel. > > > > And it works great! > > > > I''ll be posting this to the wiki soon. > > > > Bram > > > > On 6/7/06, David Morton < mortonda at dgrmm.net> wrote: > > > > > -----BEGIN PGP SIGNED MESSAGE----- > > > Hash: SHA1 > > > > > > Axiom Dadak wrote: > > > > > > > Like I said, it works, but takes 2 mins to load each page. I think > > > it''s > > > > not using SCGI, since I don''t even need to have the SCGI server > > > running > > > > for it to work. > > > > > > yeah, that sounds exactly right; the rewrite isn''t matching the new > > > urls. I''m a > > > bit busy to look into it more deeply, but if I remember right, there > > > is some > > > difficulty with getting the rewrite to work. > > > > > > > > > - -- > > > David Morton > > > Maia Mailguard - http://www.maiamailguard.com > > > Morton Software Design and Consulting - http://www.dgrmm.net > > > -----BEGIN PGP SIGNATURE----- > > > Version: GnuPG v1.4.2.2 (GNU/Linux) > > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > > > > > iD8DBQFEhx6LUy30ODPkzl0RAiTxAJoCazhSyvt0T16zmXwEWa2BEUAaugCfWdxe > > > LXTNX4uDVyqvWiK0TgPKp5w> > > =ZIR5 > > > -----END PGP SIGNATURE----- > > > _______________________________________________ > > > Instantrails-users mailing list > > > Instantrails-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/instantrails-users > > > > > > > > > _______________________________________________ > > Instantrails-users mailing list > > Instantrails-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/instantrails-users > > > > > > _______________________________________________ > Instantrails-users mailing list > Instantrails-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/instantrails-users > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/instantrails-users/attachments/20060608/46ca047a/attachment-0001.htm
THanks! On 6/8/06, Axiom Dadak <axiomdadak at gmail.com> wrote:> > Already done and there is a link to it from the FAQ. > > > On 6/7/06, Curt Hibbs <curt.hibbs at gmail.com> wrote: > > > > Excellent! Can you add instructions for this on the Instant Raiks wiki? > > > > Thanks, > > Curt > > > > > > On 6/7/06, Axiom Dadak < axiomdadak at gmail.com> wrote: > > > > > > Ok, I solved it! > > > > > > It took a lot of playing around, but I''ve got it working now. > > > > > > This is how you setup a rails application in apache using aliases and > > > SCGI: > > > > > > (in this case, my application is called scotch and it usses port 9997) > > > > > > httpd.conf -> > > > > > > Alias /scotch/ "${path}/rails_apps/scotch/public/" > > > SCGIMount /scotch/dispatch.fcgi 127.0.0.1:9997 > > > > > > <Directory "${path}/rails_apps/scotch/public"> > > > Options ExecCGI > > > Options +FollowSymLinks > > > Order allow,deny > > > allow from all > > > </Directory> > > > > > > Then in the .htaccess file in the application''s public directory -> > > > > > > AddHandler fastcgi-script .fcgi > > > AddHandler cgi-script .cgi > > > Options +FollowSymLinks +ExecCGI > > > RewriteEngine On > > > RewriteBase /scotch > > > RewriteRule ^$ index.html [QSA] > > > RewriteRule ^([^.]+)$ $1.html [QSA] > > > RewriteCond %{REQUEST_FILENAME} !-f > > > RewriteRule ^(.*)$ /scotch/dispatch.fcgi/$1 [QSA,L] > > > ErrorDocument 500 "<h2>Application error</h2>Rails application failed > > > to start properly" > > > > > > Then, when you''re ready to run your application, start the SCGI server > > > through the "instantrails->manage applications" control pannel. > > > > > > And it works great! > > > > > > I''ll be posting this to the wiki soon. > > > > > > Bram > > > > > > On 6/7/06, David Morton < mortonda at dgrmm.net> wrote: > > > > > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > Hash: SHA1 > > > > > > > > Axiom Dadak wrote: > > > > > > > > > Like I said, it works, but takes 2 mins to load each page. I > > > > think it''s > > > > > not using SCGI, since I don''t even need to have the SCGI server > > > > running > > > > > for it to work. > > > > > > > > yeah, that sounds exactly right; the rewrite isn''t matching the new > > > > urls. I''m a > > > > bit busy to look into it more deeply, but if I remember right, there > > > > is some > > > > difficulty with getting the rewrite to work. > > > > > > > > > > > > - -- > > > > David Morton > > > > Maia Mailguard - http://www.maiamailguard.com > > > > Morton Software Design and Consulting - http://www.dgrmm.net > > > > -----BEGIN PGP SIGNATURE----- > > > > Version: GnuPG v1.4.2.2 (GNU/Linux) > > > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > > > > > > > iD8DBQFEhx6LUy30ODPkzl0RAiTxAJoCazhSyvt0T16zmXwEWa2BEUAaugCfWdxe > > > > LXTNX4uDVyqvWiK0TgPKp5w> > > > =ZIR5 > > > > -----END PGP SIGNATURE----- > > > > _______________________________________________ > > > > Instantrails-users mailing list > > > > Instantrails-users at rubyforge.org > > > > http://rubyforge.org/mailman/listinfo/instantrails-users > > > > > > > > > > > > > _______________________________________________ > > > Instantrails-users mailing list > > > Instantrails-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/instantrails-users > > > > > > > > > > _______________________________________________ > > Instantrails-users mailing list > > Instantrails-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/instantrails-users > > > > > > _______________________________________________ > Instantrails-users mailing list > Instantrails-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/instantrails-users > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/instantrails-users/attachments/20060608/9553da35/attachment.htm