Current time: 11-26-2024, 06:12 PM Hello There, Guest! (LoginRegister)


Post Reply 
mod_rails and ispCPOmega
Author Message
samducker Offline
Junior Member
*

Posts: 24
Joined: Apr 2008
Reputation: 0
Post: #1
mod_rails and ispCPOmega
Can I get rails via mod_rails or any other method to work while using ispCPOmega
08-11-2008 08:33 AM
Find all posts by this user Quote this message in a reply
gOOvER Offline
Banned

Posts: 3,561
Joined: Jul 2007
Post: #2
RE: mod_rails and ispCPOmega
I think it's possible. You have to try it.
08-11-2008 03:07 PM
Visit this user's website Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #3
RE: mod_rails and ispCPOmega
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
08-12-2008 07:04 PM
Visit this user's website Find all posts by this user Quote this message in a reply
blub Offline
Junior Member
*

Posts: 21
Joined: Jan 2008
Reputation: 0
Post: #4
RE: mod_rails and ispCPOmega
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
(This post was last modified: 03-29-2010 04:58 AM by blub.)
03-29-2010 04:42 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)