R
Robert Feldt
Some of our students have developed a Rails app on Windows (w rails
0.8.5) that we now want to deploy on a linux (gentoo) server with
apache and FastCGI and rails 0.9.5. We have followed the tutorial and
converted the app to 0.9.5 and it seems to work since we can access it
when we run it via webbrick.
We have also tried following the different (quite spread and hard to
find in one easy place IOHO ) advice on how to deploy on FastCGI but
it does not work. Below are some extracts from relevant config and log
files. Please help spot our mistake since we need to get this up and
running and FastCGI (and ok rails ) is new to us.
Thanks,
Robert
/etc/conf.d/apache2:
...
APACHE2_OPTS="-D SSL -D DAV -D DAV_FS -D SVN -D FASTCGI"
...
/etc/apache2/conf/modules.d/20_mod_fastcgi.conf:
<IfDefine FASTCGI>
<IfModule !mod_fastcgi.c>
LoadModule fastcgi_module extramodules/mod_fastcgi.so
</IfModule>
<IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
</IfModule>
</IfDefine>
/etc/apache2/conf/vhosts/ourvhosts.conf:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName orig.htu.se
DocumentRoot /var/www/localhost/htdocs
...
</VirtualHost>
<VirtualHost *:80>
ServerName railsapp.htu.se
DocumentRoot /home/railsapp/railsapp/public
ErrorLog /home/railsapp/railsapp/log/apache.log
<Directory /home/railsapp/railsapp/public/>
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AddHandler fastcgi-script .fcgi
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
/home/railsapp/railsapp/public/.htaccess:
...
RewriteBase /dispatch.fcgi
...
Now when I try to open railsapp.htu.se I get in my browser:
"Application error (Apache)
Change this error message for exceptions thrown outside of an action
(like in Dispatcher setups or broken Ruby code) in public/500.html"
and /home/railsapp/railsapp/log/apache.log contains:
[Sun Feb 13 22:48:21 2005] [error] [client 212.109.29.132] FastCGI: comm with (d
ynamic) server "/home/score/s-core/public/dispatch.fcgi" aborted: (first read) i
dle timeout (30 sec)
[Sun Feb 13 22:48:21 2005] [error] [client 212.109.29.132] FastCGI: incomplete h
eaders (0 bytes) received from server "/home/score/s-core/public/dispatch.fcgi"
[Sun Feb 13 22:48:22 2005] [error] [client 212.109.29.132] File does not exist:
/home/score/s-core/public/favicon.ico
0.8.5) that we now want to deploy on a linux (gentoo) server with
apache and FastCGI and rails 0.9.5. We have followed the tutorial and
converted the app to 0.9.5 and it seems to work since we can access it
when we run it via webbrick.
We have also tried following the different (quite spread and hard to
find in one easy place IOHO ) advice on how to deploy on FastCGI but
it does not work. Below are some extracts from relevant config and log
files. Please help spot our mistake since we need to get this up and
running and FastCGI (and ok rails ) is new to us.
Thanks,
Robert
/etc/conf.d/apache2:
...
APACHE2_OPTS="-D SSL -D DAV -D DAV_FS -D SVN -D FASTCGI"
...
/etc/apache2/conf/modules.d/20_mod_fastcgi.conf:
<IfDefine FASTCGI>
<IfModule !mod_fastcgi.c>
LoadModule fastcgi_module extramodules/mod_fastcgi.so
</IfModule>
<IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
</IfModule>
</IfDefine>
/etc/apache2/conf/vhosts/ourvhosts.conf:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName orig.htu.se
DocumentRoot /var/www/localhost/htdocs
...
</VirtualHost>
<VirtualHost *:80>
ServerName railsapp.htu.se
DocumentRoot /home/railsapp/railsapp/public
ErrorLog /home/railsapp/railsapp/log/apache.log
<Directory /home/railsapp/railsapp/public/>
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AddHandler fastcgi-script .fcgi
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
/home/railsapp/railsapp/public/.htaccess:
...
RewriteBase /dispatch.fcgi
...
Now when I try to open railsapp.htu.se I get in my browser:
"Application error (Apache)
Change this error message for exceptions thrown outside of an action
(like in Dispatcher setups or broken Ruby code) in public/500.html"
and /home/railsapp/railsapp/log/apache.log contains:
[Sun Feb 13 22:48:21 2005] [error] [client 212.109.29.132] FastCGI: comm with (d
ynamic) server "/home/score/s-core/public/dispatch.fcgi" aborted: (first read) i
dle timeout (30 sec)
[Sun Feb 13 22:48:21 2005] [error] [client 212.109.29.132] FastCGI: incomplete h
eaders (0 bytes) received from server "/home/score/s-core/public/dispatch.fcgi"
[Sun Feb 13 22:48:22 2005] [error] [client 212.109.29.132] File does not exist:
/home/score/s-core/public/favicon.ico