Deploying Radiant on Debian with Apache 2 and fastcgi


#1

Hi,

I tried to deploy my Radiant application using Apache 2 and fastcgi on
Debian.

I modified the file public/.htaccess, adding:

AddHandler fcgid-script .fcgi

and created a virtual host like this:

[code]<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName ruby.cms01.uperto.int
DocumentRoot /var/www/test/public/
ErrorLog /var/www/test/log/apache.log

<Directory /var/www/test/public/>
    Options Indexes FollowSymLinks MultiViews ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

[/code]

It is working, when I go to ruby.cms01.uperto.int, it goes to the real
path, which is /var/www/test/public/ and the login page appears, but my
problem is that I don’t have any images, stylesheets or javascript.
I tried with aliases, but it doesn’t work…

I really don’t find answers anymore, and a little help would be great!

Thanks in advance, and tell me if you need more information :wink:


#2

In public/.htaccess, you also need to replace:
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

with:
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

That is, “.cgi” becomes “.fcgi”.

I have the same configuration and have it working.

HTH,
~joe


#3

Hi,

Thanks for answering.

I actually did what you say before, but forgot to mention it. So I guess
it is not this which cause my problem. I really don’t know what it could
be.

Thanks a lot.


#4

I had another problem as well, where textile wouldn’t function and the
pages/snippets/layouts tabs didn’t appear, etc. I’m not sure how that
got fixed, except that I had restarted my browser meantime. A session
management issue? Your symptoms didn’t seem the same, though.

~joe


#5

Check your apache error log and see where it is looking to get load your
stylesheets from.


#6

Hi,

I checked the log, here is where it takes the stylesheets and images:

[…]

Processing SiteController#show_page (for 192.168.30.63 at 2007-07-06
10:14:42) [GET]
Parameters: {“1183563136”=>nil, “action”=>“show_page”,
“url”=>[“stylesheets”, “admin”, “main.css”], “controller”=>“site”}
Redirected to http://ruby.cms01.uperto.int/admin/welcome
Completed in 0.00555 (180 reqs/sec) | DB: 0.00288 (51%) | 302 Found
[http://ruby.cms01.uperto.int/stylesheets/admin/main.css?1183563136]

[…]

Processing SiteController#show_page (for 192.168.30.63 at 2007-07-06
10:14:45) [GET]
Parameters: {“1183563136”=>nil, “action”=>“show_page”,
“url”=>[“images”, “admin”, “view-site.gif”], “controller”=>“site”}
Redirected to http://ruby.cms01.uperto.int/admin/welcome
Completed in 0.00538 (185 reqs/sec) | DB: 0.00283 (52%) | 302 Found
[http://ruby.cms01.uperto.int/images/admin/view-site.gif?1183563136]

[…]

So it goes to http://ruby.cms01.uperto.int/images for the images and
http://ruby.cms01.uperto.int/stylesheets for the stylesheets. Images and
stylesheets are actually in /var/www/test/public/images (or
…/stylesheets). But with the settings of the virtual host, it should
transform ruby.cms01.uperto.int in /var/www/test/public/ , isn’t it? Is
there another option that I should add?

Thanks


#7

Ok it works by redirecting to fcgi only files that doesn’t exist on the
server:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

And with these two more rules it manages the static cache:

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]