- Windows: ruby script/server webrick
- Unix/Mac/Linux: script/server webrick
The second way of starting up an RoR application is by not specifying the webrick argument on the command line. It would look like this:
- Windows: ruby script/server
- Unix/Mac/Linux: script/server
=> Booting lighttpd (use 'script/server webrick' to force WEBrick)
=> Rails application started on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)
/Users/jeanpaul/webworkspace/ToDo/public/../config/boot.rb:18:in `require': No such file to load -- rubygems (LoadError)
from /Users/jeanpaul/webworkspace/ToDo/public/../config/boot.rb:18
from /Users/jeanpaul/webworkspace/ToDo/public/../config/environment.rb:11:in `require'
from /Users/jeanpaul/webworkspace/ToDo/public/../config/environment.rb:11
from /Users/jeanpaul/webworkspace/ToDo/public/dispatch.fcgi:21:in `require'
from /Users/jeanpaul/webworkspace/ToDo/public/dispatch.fcgi:21
2007-01-20 00:51:56: (mod_fastcgi.c.1048) the fastcgi-backend /Users/jeanpaul/webworkspace/ToDo/public/dispatch.fcgi failed to start:
2007-01-20 00:51:56: (mod_fastcgi.c.1052) child exited with status 1 /Users/jeanpaul/webworkspace/ToDo/public/dispatch.fcgi
2007-01-20 00:51:56: (mod_fastcgi.c.1055) if you try do run PHP as FastCGI backend make sure you use the FastCGI enabled version.
You can find out if it is the right one by executing 'php -v' and it should display '(cgi-fcgi)' in the output, NOT (cgi) NOR (cli)
For more information check http://www.lighttpd.net/documentation/fastcgi.html#preparing-php-as-a-fastcgi-program
2007-01-20 00:51:56: (mod_fastcgi.c.1060) If this is PHP on Gentoo add fastcgi to the USE flags
2007-01-20 00:51:56: (mod_fastcgi.c.1356) [ERROR]: spawning fcgi failed.
2007-01-20 00:51:56: (server.c.834) Configuration of plugins failed. Going down.
If you took a chance and directed your browser to [http://localhost:3000], you might see a [500 - Internal Server Error] being displayed.
What all these errors suggest is that your rubygems path is wrong or that you did not install rubygems at all. After spending quite sometime struggling with this, I found out that all that needed to be done was to change the path to ruby in your [dispatch.fcgi] file. In order to get that done, run the following command on your terminal / command prompt:
- which ruby
The next step is to open the [dispatch.fcgi] file and change the path to ruby at the beginning of the file to what had been displayed on the terminal. The [dispatch.fcgi] file usually sits in the [public] folder of your rails application. When you open the file, you should see something similar to the following line at the beginning of it:
- #!/usr/bin/ruby
- #!/your/path/to/ruby/as/known/by/your/computer
- In my case, that would be #!/usr/local/bin/ruby
Voila! You just got Rails to run with LightTPD and mod_fcgi. ;-)
Thanks for your post. I'm still getting this error, even after updating my config file's shebang line to my correct path.
ReplyDeleteHere's the output I receive:
tickle:~/Development/drewnoakes.com/trunk/rails/root Drew$ script/server
=> Booting lighttpd (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)
2007-01-30 15:04:28: (mod_fastcgi.c.1022) execve failed for: /Users/Drew/Development/drewnoakes.com/trunk/rails/root/public/dispatch.fcgi Permission denied
2007-01-30 15:04:28: (mod_fastcgi.c.1048) the fastcgi-backend /Users/Drew/Development/drewnoakes.com/trunk/rails/root/public/dispatch.fcgi failed to start:
2007-01-30 15:04:28: (mod_fastcgi.c.1052) child exited with status 13 /Users/Drew/Development/drewnoakes.com/trunk/rails/root/public/dispatch.fcgi
2007-01-30 15:04:28: (mod_fastcgi.c.1055) if you try do run PHP as FastCGI backend make sure you use the FastCGI enabled version.
You can find out if it is the right one by executing 'php -v' and it should display '(cgi-fcgi)' in the output, NOT (cgi) NOR (cli)
For more information check http://www.lighttpd.net/documentation/fastcgi.html#preparing-php-as-a-fastcgi-program
2007-01-30 15:04:28: (mod_fastcgi.c.1060) If this is PHP on Gentoo add fastcgi to the USE flags
2007-01-30 15:04:28: (mod_fastcgi.c.1356) [ERROR]: spawning fcgi failed.
2007-01-30 15:04:28: (server.c.834) Configuration of plugins failed. Going down.
Exiting
Couldn't find any pid file in '/Users/Drew/Development/drewnoakes.com/trunk/rails/root/tmp/pids' matching 'dispatch.[0-9]*.pid'
(also looked for processes matching "/Users/Drew/Development/drewnoakes.com/trunk/rails/root/public/dispatch.fcgi")
Any thoughts appreciated!
Hi Drew,
ReplyDeletefrom what it seems, Lightpd cannot (or does not have) the permission to access your rails directory. So you might want to change the current permissions by `chmod -R 777 your_rails_directory` just to check and see what happens.
If it does not work, this would require further investigation.
Please let me know.
Regards,
Jean-Paul H.
Hello,
ReplyDeleterails (on lighttpd) worked fine untill i did an upgrad to 1.2.2. then i started to receive the following error
$ script/server
=> Booting lighttpd (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/routing.rb:954:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
from /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/routing.rb:954:in `build'
from /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/routing.rb:1172:in `add_route'
from /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/routing.rb:986:in `connect'
from /home/nira/archi_2/trunk/public/../config/../config/routes.rb:15
from /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/routing.rb:1139:in `draw'
from /home/nira/archi_2/trunk/public/../config/../config/routes.rb:1
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/dependencies.rb:488:in `load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/dependencies.rb:342:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/dependencies.rb:488:in `load'
from /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/routing.rb:1165:in `load_routes!'
from /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/routing.rb:1157:in `reload'
from /usr/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/initializer.rb:287:in `initialize_routing'
from /usr/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/initializer.rb:111:in `process'
from /usr/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/initializer.rb:43:in `run'
from /home/nira/archi_2/trunk/public/../config/environment.rb:14
from /home/nira/archi_2/trunk/public/dispatch.fcgi:21
new rails application work fine but my old dont:(
i`m trying to figure it out for hours!
any suggestions?
Thanks so much for posting this. I was afraid I was going to be battling this all night.
ReplyDelete