ispCP - Board - Support
mod_rails and ispCPOmega - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Development Area (/forum-1.html)
+--- Forum: General discussion (/forum-11.html)
+--- Thread: mod_rails and ispCPOmega (/thread-4006.html)



mod_rails and ispCPOmega - samducker - 08-11-2008 08:33 AM

Can I get rails via mod_rails or any other method to work while using ispCPOmega


RE: mod_rails and ispCPOmega - gOOvER - 08-11-2008 03:07 PM

I think it's possible. You have to try it.


RE: mod_rails and ispCPOmega - kilburn - 08-12-2008 07:04 PM

Debian lenny fastcgi+rails mini-howto

As fastcgi is already enabled by default in ispcp and fastcgi+rails gives a decent performance (see this benchmark where this setup gets the 2nd place) I've deciced to give it a try:

1. Install required packages:
Code:
apt-get install libmysql-ruby ruby ri rdoc irb libreadline-ruby libruby libopenssl-ruby libsqlite-ruby libfcgi-ruby1.8 rubygems

2. Install the rails framework
Code:
gem install rails --include-dependencies

3. Upload your rails app to the home of the desired domain (ie: /var/www/virtual/domain.tld/)
Code:
/var/www/virtual/domain.tld
    /railsapp1
        /config
        /app
        ...
   /railsapp2
        /config
        /app
        ...

4. Remove the htdocs folder and symlink it to the public folder of the default app (don't do it if you don't want a rails app as default page)
Code:
cd /var/www/virtual/domain.tld
rm -rf htdocs
ln -s railsapp1/public htdocs

5. Symlink any other rails app public folder to the apropiate location
Code:
cd /var/www/virtual/domain.tld
ln -s railsapp2/public htdocs/railsapp2

6. Write an htaccess to redirect requests to the dispatcher.fcgi file

/var/www/domain.tld/htdocs/.htaccess:
Code:
RewriteEngine On

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

This worked for me, hope it helps others Smile


RE: mod_rails and ispCPOmega - blub - 03-29-2010 04:42 AM

Hello Forum,

i tried to set up an Ruby Project on my Server, but i get only Error 500.

I Added the Handlers because i whithout i only a Page with the Code of the dispach.fcgi.

Code:
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FolowSymLinks +ExecCGI

RewriteEngine On

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

ErrorDocument 500 /500.html

This is the Code of my dispathc.fcgi
Code:
!/usr/bin/env ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
# and the GC period is nil (turned off).  A reasonable number of requests
# could range from 10-100 depending on the memory footprint of your app.
#
# Example:
#   # Default log path, normal GC behavior.
#   RailsFCGIHandler.process!
#
#   # Default log path, 50 requests between GC.
#   RailsFCGIHandler.process! nil, 50
#
#   # Custom log path, normal GC behavior.
#   RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
#
require File.dirname(__FILE__) + "/../config/environment"
require 'fcgi_handler'

RailsFCGIHandler.process!

I dont know where to look. I didnt see any logs which are helpfull. Any hint ist welcome.

Blub
Code:
Options +FolowSymLinks +ExecCGI
this is wrong must be:
Code:
Options +FollowSymLinks +ExecCGI

But now i have an invinite loop. The Browser is loading and loading and loading.

I cannot find the process anywhere. Need help.

Blub