PDA

View Full Version : can't configure rails path


karloff
01-20-2008, 08:34 AM
I seem to be having trouble setting my rails path


i enter /usr/local/bin/ruby and it says that i need to create manually.

i have check the permissions 0777, and the owner is nobody and group nobody (i also changed this to root and still it didn't work)

anyone help me out. what am i doing wrong?

mistwang
01-20-2008, 01:12 PM
Are your lshttpd running as "nobody"? please check with "ps -ef | grep lshttpd".
Try command

sudo -u nobody /usr/local/bin/ruby -v

see if it works. If you got permission problem, you need to check the permission of directories along the path.
Is there any symbolic link along the path?
You can try manually change it by editing httpd_config.xml directly, see if it works.

karloff
01-20-2008, 02:21 PM
Are your lshttpd running as "nobody"? please check with "ps -ef | grep lshttpd".
Try command

sudo -u nobody /usr/local/bin/ruby -v

see if it works. If you got permission problem, you need to check the permission of directories along the path.
Is there any symbolic link along the path?
You can try manually change it by editing httpd_config.xml directly, see if it works.

can't find a permissions problem, i think anyway. should every dir along the path be set to nobody?

i tried to manually set the path to /usr/local/bin/ruby/

but get this error message now missing <uri> in <context>

here is my rails.xml can you see any prob with it?
<?xml version="1.0" encoding="UTF-8"?>
<virtualHostTemplate>
<vhRoot>$SERVER_ROOT/$VH_NAME/</vhRoot>
<configFile>$SERVER_ROOT/conf/$VH_NAME.xml</configFile>
<maxKeepAliveReq></maxKeepAliveReq>
<smartKeepAlive></smartKeepAlive>
<allowSymbolLink>1</allowSymbolLink>
<enableScript>1</enableScript>
<restrained>1</restrained>
<setUIDMode>2</setUIDMode>
<chrootMode>0</chrootMode>
<virtualHostConfig>
<docRoot>$VH_ROOT/public</docRoot>
<enableGzip>1</enableGzip>
<enableIpGeo></enableIpGeo>
<adminEmails></adminEmails>
<logging>
<log>
<useServer>1</useServer>
</log>
<accessLog>
<useServer>0</useServer>
<fileName>$SERVER_ROOT/logs/$VH_NAME.access.log</fileName>
<logHeaders>3</logHeaders>
<rollingSize>500M</rollingSize>
<keepDays>30</keepDays>
<compressArchive>0</compressArchive>
</accessLog>
</logging>
<index>
<useServer>0</useServer>
<indexFiles>index.html, index.htm</indexFiles>
<autoIndex>0</autoIndex>
<autoIndexURI>/_autoindex/default.php</autoIndexURI>
</index>
<htAccess>
<allowOverride>0</allowOverride>
<accessFileName>.htaccess</accessFileName>
</htAccess>
<expires>
<enableExpires>1</enableExpires>
</expires>
<security>
<hotlinkCtrl>
<enableHotlinkCtrl>0</enableHotlinkCtrl>
<suffixes>gif, jpeg, jpg</suffixes>
<allowDirectAccess>1</allowDirectAccess>
<onlySelf>1</onlySelf>
</hotlinkCtrl>
<accessControl>
<allow>*</allow>
</accessControl>
</security>
<contextList>
<context>
<type>rails</type>
<uri>/usr/local/bin/ruby/</uri>
<location>$VH_ROOT/</location>
<railsEnv>1</railsEnv>
<maxConns>5</maxConns>
<addDefaultCharset>off</addDefaultCharset>
<rewrite>
<enable>1</enable>
<inherit></inherit>
<base></base>
<rules>RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]</rules>
</rewrite>
</context>
</contextList>
<rewrite>
<enable>0</enable>
<logLevel>0</logLevel>
</rewrite>
<frontPage>
<enable>0</enable>
<disableAdmin>0</disableAdmin>
</frontPage>
<awstats>
<updateMode>0</updateMode>
<workingDir>$VH_ROOT/awstats</workingDir>
<awstatsURI>/awstats/</awstatsURI>
<siteDomain>localhost</siteDomain>
<siteAliases>127.0.0.1 localhost</siteAliases>
<updateInterval>86400</updateInterval>
<updateOffset>0</updateOffset>
<securedConn>0</securedConn>
</awstats>
</virtualHostConfig>
</virtualHostTemplate>

mistwang
01-20-2008, 02:23 PM
You should use the root directory of your RoR application for a Rails context configuration, not the path to ruby command.

karloff
01-20-2008, 02:32 PM
ok, so the uri should be set to $VH_ROOT/?


also i have my railsrunner.rb file which is like this#!/usr/bin/ruby

Dir.chdir( ENV['RAILS_ROOT'] )

require 'config/environment'

require 'initializer'
require 'dispatcher'

#require 'breakpoint' if defined?(BREAKPOINT_SERVER_PORT)

#if RAILS_ENV=='production'
# require_dependency 'application'
# Dir.foreach( "app/models" ) {|f| silence_warnings{require_dependency f} if f =~ /\.rb$/}
# Dir.foreach( "app/controllers" ) {|f| silence_warnings{require_dependency f} if f =~ /\.rb$/}
#end

require 'lsapi'

#Close all DB connections established during initialization
ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord::Base)

while LSAPI.accept != nil
Dispatcher.dispatch
end


should the path at the top be /usr/local/bin/ruby??

mistwang
01-20-2008, 05:25 PM
Yes, you can change that. But it should not matter as LSWS use the configuration under ruby tab.
You should not change the default Rails template which should work well.

karloff
01-21-2008, 12:49 PM
what should the uri be in the rails.xml file?

i get this error

missing <uri> in <context>

mistwang
01-21-2008, 01:20 PM
You should use "/" for the URI, it was "/usr/local/bin/ruby".

karloff
01-21-2008, 01:39 PM
thats what i put and i get this error?
2008-01-21 16:38:29.986 ERROR [config:vhost:paulcurley.co.uk:context:/] rewrite: Rewrite rule missing substitution string. while parsing: RewriteRule ^$

2008-01-21 16:38:29.989 ERROR execle() failed with errno=13, when try to start Fast CGI application: /usr/local/bin/ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb!

2008-01-21 16:38:29.991 ERROR execle() failed with errno=13, when try to start Fast CGI application: /usr/local/bin/ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb!

mistwang
01-21-2008, 01:46 PM
Please try
sudo -u nobody /usr/local/bin/ruby /usr/local/lsws/fcgi-bin/RailsRunner.rbThen keep trying until you figured out the permission problem. :)
Once it passes, your litespeed rails will work.

Command

sudo -u nobody strace /usr/local/bin/ruby /usr/local/lsws/fcgi-bin/RailsRunner.rbshould be able to help you figure it out.

karloff
01-21-2008, 02:32 PM
cheers, having other probs (not related to lsws) that i need to sort, but i will get the rest by myself. thanks man:)