# Problem with Apache 2 and mod\_fcgid

**URL:** <https://www.ruby-forum.com/t/problem-with-apache-2-and-mod-fcgid/71271>\
**Category:** Rails\
**Created:** [October 6, 2006, 3:50pm UTC](https://www.ruby-forum.com/t/problem-with-apache-2-and-mod-fcgid/71271 "2006-10-06T15:50:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![CSSSSdric\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@CSSSSdric\_H](https://www.ruby-forum.com/u/CSSSSdric_H)\
**Post date:** [October 6, 2006, 3:50pm UTC](https://www.ruby-forum.com/t/problem-with-apache-2-and-mod-fcgid/71271/1 "2006-10-06T15:50:01Z")

</div>

Hi,

I have a problem with Apache 2 and mod\_fcgid.

In fact, it seems there are correctly installed and configured: my  
rails application works (see [http://www.cedrich.be/index](http://www.cedrich.be/index) ) … but the  
stylesheets aren’t loaded.

The generated url ( \<%= stylesheet\_link\_tag “styles”, :media =\> “all”  
%\> ) looks correct.

But when I try to access the stylesheet (see  
[http://www.cedrich.be/stylesheets/styles.css](http://www.cedrich.be/stylesheets/styles.css) ), I have a HTTP 500 error  
(internal server error).

\*\* Apache 2 ( under FreeBSD 6) configuration:

LoadModule fcgid\_module libexec/apache2/mod\_fcgid.so  
  
AddHandler fcgid-script .fcgi  
SocketPath /tmp/fcgi\_ipc  
DefaultInitEnv RAILS\_ENV production  
IdleTimeout 600  
ProcessLifeTime 3600  
MaxProcessCount 8  
IPCConnectTimeout 60  
IPCCommTimeout 60

\*\* Virtual host configuration :

\<VirtualHost \*:80\>  
DocumentRoot /var/www/cedric/www.cedrich.net/public/  
ServerName www.cedrich.be  
CustomLog /var/log/bepolytech/cedrich combined  
ErrorLog /var/log/bepolytech/cedrich.error

```
    <Location />
    AddHandler fcgid-script .fcgi

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

```

```
    ErrorDocument 500 /500.html
    ErrorDocument 404 /404.html

    <Directory "/var/www/cedric/www.cedrich.net/public/">
    SetHandler fcgid-script
    Options Indexes +FollowSymlinks +ExecCGI
    AllowOverride all
    Order allow,deny
    Allow from all
    </Directory>

```

\*\* And my public/.htaccess (uncommented lines):

AddHandler fcgid-script .fcgi  
Options +FollowSymLinks +ExecCGI  
RewriteEngine On  
RewriteRule ^$ index.html [QSA]  
RewriteRule ^([^.]+)$ $1.html [QSA]  
RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteRule ^(.\*)$ dispatch.cgi [QSA,L]

Could you help me ?

Thanks !

---

<div class="post-metadata">

**Author:** ![CSSSSdric\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@CSSSSdric\_H](https://www.ruby-forum.com/u/CSSSSdric_H)\
**Post date:** [October 6, 2006, 5:34pm UTC](https://www.ruby-forum.com/t/problem-with-apache-2-and-mod-fcgid/71271/2 "2006-10-06T17:34:27Z")

</div>

I think all non-rails URL’s ( like  
[http://www.cedrich.be/images/rails.png](http://www.cedrich.be/images/rails.png) ) are wrong ( HTTP 500 error).

It’s weird :s

---

<div class="post-metadata">

**Author:** ![CSSSSdric\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@CSSSSdric\_H](https://www.ruby-forum.com/u/CSSSSdric_H)\
**Post date:** [October 7, 2006, 1:07am UTC](https://www.ruby-forum.com/t/problem-with-apache-2-and-mod-fcgid/71271/3 "2006-10-07T01:07:35Z")

</div>

hi cedric

in .htaccess u have to put RewriteRule ^(._)$ dispatch.fcgi [QSA,L] not  
RewriteRule ^(._)$ dispatch.cgi [QSA,L]

also this is weird u should check again if files are uploaded

also why did u copy and paste .htaccess rules in the apache config, u  
should  
put it in only one place

–  
Heri R.  
[http://sprinj.com](http://sprinj.com)

---

<div class="post-metadata">

**Author:** ![CSSSSdric\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@CSSSSdric\_H](https://www.ruby-forum.com/u/CSSSSdric_H)\
**Post date:** [October 23, 2006, 8:08am UTC](https://www.ruby-forum.com/t/problem-with-apache-2-and-mod-fcgid/71271/4 "2006-10-23T08:08:50Z")

</div>

Hi

My .htaccess is now correct and I removed the rules from apache config.  
And the files are uploaded…

I don’t understand how to successfully configure apache and fcgid …  
grrrrr …

---

<div class="post-metadata">

**Author:** ![CSSSSdric\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@CSSSSdric\_H](https://www.ruby-forum.com/u/CSSSSdric_H)\
**Post date:** [October 23, 2006, 8:36am UTC](https://www.ruby-forum.com/t/problem-with-apache-2-and-mod-fcgid/71271/5 "2006-10-23T08:36:55Z")

</div>

On Oct 23, 2006, at 12:06 AM, Cédric H. wrote:

> My .htaccess is now correct and I removed the rules from apache  
> config.  
> And the files are uploaded…
> 
> I don’t understand how to successfully configure apache and fcgid …  
> grrrrr …

I would _highly_ recommend using mongrel instead.

[http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![CSSSSdric\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@CSSSSdric\_H](https://www.ruby-forum.com/u/CSSSSdric_H)\
**Post date:** [October 23, 2006, 9:12am UTC](https://www.ruby-forum.com/t/problem-with-apache-2-and-mod-fcgid/71271/6 "2006-10-23T09:12:59Z")

</div>

Correction: it’s not as complicated as I though:

[http://mongrel.rubyforge.org/docs/apache.html](http://mongrel.rubyforge.org/docs/apache.html)

😃

---

<div class="post-metadata">

**Author:** ![CSSSSdric\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@CSSSSdric\_H](https://www.ruby-forum.com/u/CSSSSdric_H)\
**Post date:** [October 23, 2006, 11:38am UTC](https://www.ruby-forum.com/t/problem-with-apache-2-and-mod-fcgid/71271/7 "2006-10-23T11:38:13Z")

</div>

On Mon, 23 Oct 2006 07:10:16 -0000  
“Cédric H.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Correction: it’s not as complicated as I though:
> 
> [http://mongrel.rubyforge.org/docs/apache.html](http://mongrel.rubyforge.org/docs/apache.html)
> 
> 😃

[http://nanoweb.si.kz/](http://nanoweb.si.kz/) ← The PHP kind of like mongrel sort of thingy  
you could probably use.

It’s actually pretty fast, and it’d make your php apps get inline with  
the theme of “just use http”. But, I haven’t actually used it.

–  
Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

[http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)  
[http://www.lingr.com/room/3yXhqKbfPy8](http://www.lingr.com/room/3yXhqKbfPy8) – Come get help.

---

<div class="post-metadata">

**Author:** ![CSSSSdric\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@CSSSSdric\_H](https://www.ruby-forum.com/u/CSSSSdric_H)\
**Post date:** [October 23, 2006, 8:48am UTC](https://www.ruby-forum.com/t/problem-with-apache-2-and-mod-fcgid/71271/8 "2006-10-23T08:48:57Z")

</div>

Yes but the server where I host my ror application hosts some other  
websites ( php, etc) … I could try with an apache proxi server, and  
mongrel but it’s more complicated.
