Sziasztok!
Debian Etch-en tökéletessen futó PHP5-el is felruházott Apache2-höz szeretném a Ruby on Rails modult müködésre birni. Sajnos sehogysem akar sikerülni!
A Ruby-t konzolból tökéletessen tudom használni. Ha átadok neki egy program fájlt futtatásra, akkor szépen lefutatja mindenféle hiba nélkül.
Ha ugyanezt webröl szeretném megtenni, akor már gondok vannak! Jelenleg minden fájlra ugyanezt irja ki a böngészőbe:
Routing Error
Recognition failed for "/dispatch.cgi"
Rákerestem googleben a hibára, meg is csinaétam amiket irtak rá, de sajnos akor is ugyanez a hiba!
Az apache site configja:
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /var/www/rails/testapplication/public/>
Options ExecCGI FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
A Ruby .htaccess fájla:
# General Apache options
#AddHandler fastcgi-script .fcgi
#AddHandler cgi-script .cgi
AddHandler fcgid-script .fcgi
Options +FollowSymLinks +ExecCGI
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
# RewriteRule .* - [L]
# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
A Ruby altal generalt fajlok a /var/www/rails/testapplication/public/ alatt találhatók.
Ide tetem én is két Hello World kiiro progit. Ebbol egyik fut, másik nem.
Ami müködik:
#!/usr/local/bin/ruby
print "Content-type: text/html\r\n\r\n"
print "<html><body> Hello world! </body></html>\r\n"
Ez pedig már nem:
#!/usr/local/bin/ruby
class Hello
attr_reader :msg
def initialize
@msg = "Hello, World"
end
end
h = Hello.new
puts h.msg
Természetesen konzolból futtatva mindkettő müködik.
Rengeteket googleöztem, de nem jutottam megoldásra :(
Valakinek van esetleg valami mentő ötlete?