# Deploying Radiant on Debian with Apache 2 and fastcgi

**URL:** <https://www.ruby-forum.com/t/deploying-radiant-on-debian-with-apache-2-and-fastcgi/108650>\
**Category:** Radiant CMS\
**Created:** [July 5, 2007, 5:33pm UTC](https://www.ruby-forum.com/t/deploying-radiant-on-debian-with-apache-2-and-fastcgi/108650 "2007-07-05T17:33:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ouroz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/d9b06d/32.png) [@ouroz](https://www.ruby-forum.com/u/ouroz)\
**Post date:** [July 5, 2007, 5:33pm UTC](https://www.ruby-forum.com/t/deploying-radiant-on-debian-with-apache-2-and-fastcgi/108650/1 "2007-07-05T17:33:43Z")

</div>

Hi,

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

I modified the file public/.htaccess, adding:

```auto
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 😉

---

<div class="post-metadata">

**Author:** ![ouroz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/d9b06d/32.png) [@ouroz](https://www.ruby-forum.com/u/ouroz)\
**Post date:** [July 5, 2007, 5:52pm UTC](https://www.ruby-forum.com/t/deploying-radiant-on-debian-with-apache-2-and-fastcgi/108650/2 "2007-07-05T17:52:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ouroz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/d9b06d/32.png) [@ouroz](https://www.ruby-forum.com/u/ouroz)\
**Post date:** [July 5, 2007, 6:23pm UTC](https://www.ruby-forum.com/t/deploying-radiant-on-debian-with-apache-2-and-fastcgi/108650/3 "2007-07-05T18:23:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ouroz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/d9b06d/32.png) [@ouroz](https://www.ruby-forum.com/u/ouroz)\
**Post date:** [July 5, 2007, 7:36pm UTC](https://www.ruby-forum.com/t/deploying-radiant-on-debian-with-apache-2-and-fastcgi/108650/4 "2007-07-05T19:36:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ouroz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/d9b06d/32.png) [@ouroz](https://www.ruby-forum.com/u/ouroz)\
**Post date:** [July 6, 2007, 3:54am UTC](https://www.ruby-forum.com/t/deploying-radiant-on-debian-with-apache-2-and-fastcgi/108650/5 "2007-07-06T03:54:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ouroz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/d9b06d/32.png) [@ouroz](https://www.ruby-forum.com/u/ouroz)\
**Post date:** [July 6, 2007, 10:29am UTC](https://www.ruby-forum.com/t/deploying-radiant-on-debian-with-apache-2-and-fastcgi/108650/6 "2007-07-06T10:29:25Z")

</div>

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](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](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](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](http://ruby.cms01.uperto.int/images/admin/view-site.gif?1183563136)]

[…]

So it goes to [http://ruby.cms01.uperto.int/images](http://ruby.cms01.uperto.int/images) for the images and  
[http://ruby.cms01.uperto.int/stylesheets](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

---

<div class="post-metadata">

**Author:** ![ouroz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/d9b06d/32.png) [@ouroz](https://www.ruby-forum.com/u/ouroz)\
**Post date:** [July 6, 2007, 1:07pm UTC](https://www.ruby-forum.com/t/deploying-radiant-on-debian-with-apache-2-and-fastcgi/108650/7 "2007-07-06T13:07:18Z")

</div>

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]
