- 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. ;-)