Odkazy:
Uvedený postup je pro Debian Sarge, toho času stable.
FIXME:Předpokládám že máme nainstalováno vše co je popsáno v článku 47.4.9 – „Apache 2“. Doinstalujeme modul fcgid do apache a fcgi knihovnu k ruby.
Na server rapp mám enablované následující moduly apache: cgid, fcgid, rewrite, ruby, ssl, userdir.
#aptitude install libfcgi-ruby1.8 libapache2-mod-fcgid#a2enmod fcgid
Upravil jsem konfiguraci fcgid modulu takto:
Příklad 47.2. fcgid.conf
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
SocketPath /var/lib/apache2/fcgid/sock
IPCCommTimeout 120
IPCConnectTimeout 10
MaxProcessCount 40
ProcessLifeTime 86400
IdleTimeout 1800
DefaultMaxClassProcessCount 8
DefaultInitEnv RAILS_ENV production
</IfModule>FIXME:
Příklad 47.3. apache2.fcgi.conf
# Apache 2 configuration for Kontejnery using FastCGI (fcgid).
# Documentation directory is aliased into application/doc.
Alias /kontejnery/doc /home/rails/kontejnery/doc
<Directory /home/rails/kontejnery/doc>
AllowOverride None
# Access rules
Order allow,deny
Allow from all
</Directory>
# Application is aliased into public directory where are static pages
# and dispatcher.
Alias /kontejnery /home/rails/kontejnery/public
<Directory /home/rails/kontejnery/public>
Options ExecCGI FollowSymlinks
AllowOverride None
RubySafeLevel 0
RubySetEnv RAILS_ENV production
RubyRequire apache/ruby-run
<Files *.rb>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
# Restrict access to the application on apache level. We
# could specify any apache authentication.
# AuthType Basic
Order allow,deny
Allow from all
# Rewrite engine configuration
RewriteEngine On
RewriteBase /kontejnery
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
# Specific error message for error 500.
ErrorDocument 500 "<h2>Application fatal error</h2>Rails application failed to start properly."
</Directory>Může se stát že nám aplikace nefunguje, sám jsem strávil několik hodin hledáním řešení na Internetu. Po různých pokusech jsem se nakonec dostal k tomu, že jsem neměl v pořádku oprávnění na adresáři ./tmp/sessions.
Zkuste použít pro ukládání sessions databázi.
