I''ve been struggling through getting Rails to work with Apache2 & FastCGI. I used the RubyForApache distribution of mod_fastcgi, the latest stable Apache2, Windows XP. On the advice of a recent thread here, my httpd.conf fastcgi section looks like so: LoadModule fastcgi_module modules/mod_fastcgi.so <IfModule> AddHandler fastcgi-script .fcgi FastCGIConfig -idle-timeout 600 -maxClassProcesses 5 </IfModule> (More config file entries at the end of this message). [Fri Mar 18 07:55:48 2005] [error] [client 192.168.2.4] FastCGI: incomplete headers (0 bytes) received from server "C:/amalec/ruby/rails/message/public/dispatch.fcgi" Oddly, looking at development.log, the controller saw the request, and claimed to have sent a response, so something is happening between Rails, FastCGI and Apache2 on the response. Everything works fine locally on the box, and works semi-OK (some actions work, some don''t) on my work network, but doesn''t work at all in the home network. Any advice greatly appreciated! Thanks, Arien ================My httpd.conf virtual directory section looks thus: <VirtualHost *> ServerName msg DocumentRoot C:/amalec/ruby/rails/message/public ErrorLog C:/amalec/ruby/rails/message/log/apache.log <Directory C:/amalec/ruby/rails/message/public/> Options ExecCGI FollowSymLinks AddHandler fcgi-script .fcgi AllowOverride all Allow from all Order allow,deny </Directory> </VirtualHost> & my .htaccess is # General Apache options AddHandler fastcgi-script .fcgi AddHandler cgi-script .cgi Options +FollowSymLinks +ExecCGI # Redirect all requests not available on the filesystem to Rails RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /dispatch.fcgi?$1 [QSA,L] # In case Rails experiences terminal errors ErrorDocument 500 /500.html
On Fri, 18 Mar 2005 08:08:42 -0800, Arien Malec <arien.malec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve been struggling through getting Rails to work with Apache2 & > FastCGI. I used the RubyForApache distribution of mod_fastcgi, the > latest stable Apache2, Windows XP.OK, there is some serious oddness going on. I tried again with WEBRick, and got: [2005-03-18 21:22:11] ERROR Errno::EINVAL: Invalid argument c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:324:in `write'' c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:324:in `<<'' c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:324:in `_write_data'' c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:317:in `_send_file'' c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:272:in `send_body_io'' c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:186:in `send_body'' c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:104:in `send_response'' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:79:in `run'' c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/ruby/lib/ruby/gems/1.8/gems/rails-0.10.1/lib/webrick_server.rb:21:in `dispatch'' script/server:48 192.168.2.4 - - [18/Mar/2005:21:22:11 Pacific Standard Time] "GET / HTTP/1.1" 200 0 - -> / At this point, I''m pretty lost. Work is fine on my local box, but I can''t effectively do xbrowser testing, because I can''t hit Rails from my wife''s iBook. I''m not sure exactly what''s going on -- any help would be appreciated. Arien
> At this point, I''m pretty lost. Work is fine on my local box, but I > can''t effectively do xbrowser testing, because I can''t hit Rails from > my wife''s iBook. I''m not sure exactly what''s going on -- any help > would be appreciated.If your machines are networked, start webrick with an accessible IP instead of localhost: ruby script/server -b 10.0.0.2 http://10.0.0.2:3000 -- rick http://techno-weenie.net