# Setting up simple CGI on Ubuntu

**URL:** <https://www.ruby-forum.com/t/setting-up-simple-cgi-on-ubuntu/71183>\
**Category:** Ruby\
**Created:** [October 5, 2006, 10:03pm UTC](https://www.ruby-forum.com/t/setting-up-simple-cgi-on-ubuntu/71183 "2006-10-05T22:03:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 5, 2006, 10:03pm UTC](https://www.ruby-forum.com/t/setting-up-simple-cgi-on-ubuntu/71183/1 "2006-10-05T22:03:40Z")

</div>

I’ve done all this numerous times before but, sigh, apparently I’m  
forgetting something. I’m just trying to serve up a straight CGI  
script, nothing fancy.

Running Ubuntu Apache2:

\<VirtualHost \*\>  
#SetEnv RAILS\_ENV development  
ServerName lilwiki  
DocumentRoot /serve/www/lilwiki/  
ErrorLog /home/trans/file/projects/PsyTower/lilwiki/log/apache.log

\<Directory /home/trans/file/projects/PsyTower/lilwiki/public/\>  
Options +ExecCGI +FollowSymLinks  
AddHandler cgi-script .rbx  
AllowOverride all  
Order allow,deny  
Allow from all

By all accounts (I just spent the last 40 minutes seaching the web and  
mailing-list) the above should be all I need. But all it does is serve  
up .rbx files as plain text --it doesn’t execute them. What am I  
missing?

T.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 6, 2006, 12:01am UTC](https://www.ruby-forum.com/t/setting-up-simple-cgi-on-ubuntu/71183/2 "2006-10-06T00:01:59Z")

</div>

Going on a few hours now. Executable bit’s set. mod\_cgid is enabled.  
I’ve poured over the directives in Apache2 manual. I’m at a loss ☹

Does anyone have any ideas at all?

T.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 6, 2006, 12:46am UTC](https://www.ruby-forum.com/t/setting-up-simple-cgi-on-ubuntu/71183/3 "2006-10-06T00:46:02Z")

</div>

TRANS wrote:

> ErrorLog /home/trans/file/projects/PsyTower/lilwiki/log/apache.log  
> By all accounts (I just spent the last 40 minutes seaching the web and  
> mailing-list) the above should be all I need. But all it does is serve  
> up .rbx files as plain text --it doesn’t execute them. What am I missing?

It’s always some stupid little thing:

```
   AddHandler cgi-script .rbx

```

Needs to be in the VirtualHost body, not the Directory body. Lovely, no  
warnings, no errors. nothing. Just doesn’t work. Five hours wasted on  
dribble. Yep that’s about par for Me and Apache configuration. Ergh…

Well, at least this post might save someone else the headache in the  
future.

Over and out,  
T.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 6, 2006, 4:58pm UTC](https://www.ruby-forum.com/t/setting-up-simple-cgi-on-ubuntu/71183/4 "2006-10-06T16:58:18Z")

</div>

On 10/5/06, Trans [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > ServerName lilwiki  
> >   
> > warnings, no errors. nothing. Just doesn’t work. Five hours wasted on  
> > dribble. Yep that’s about par for Me and Apache configuration. Ergh…

Well according to the apache documentation, AddHandler can be in the  
following contexts: server config, virtual host, directory, .htaccess

On the other hand, I’m not sure how you are getting from your document  
root

/serve/www/lilwiki/

to

/home/trans/file/projects/PsyTower/lilwiki/public/

in the absense of any apparent Alias directive or anything else which  
would cause Apache to look there.

–  
Rick DeNatale

My blog on Ruby  
[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 9, 2006, 9:06pm UTC](https://www.ruby-forum.com/t/setting-up-simple-cgi-on-ubuntu/71183/5 "2006-10-09T21:06:38Z")

</div>

On 10/6/06, Trans [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > > ```
> > > > Order allow,deny
> > > > 
> > > > ```
> > > 
> > > ```
> > > AddHandler cgi-script .rbx
> > > 
> > > ```
> > 
> > /serve/www/lilwiki/  
> > /serve/www/lilwiki/ =\>  
> > /home/trans/file/projects/PsyTower/lilwiki/public/

I suspected that, and I also suspect that Apache is completely aware  
of the link and only knows about /serve/www/lilwiki, so the Directory  
directive never has any effect.

–  
Rick DeNatale

My blog on Ruby  
[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 10, 2006, 2:01am UTC](https://www.ruby-forum.com/t/setting-up-simple-cgi-on-ubuntu/71183/6 "2006-10-10T02:01:13Z")

</div>

Rick DeNatale wrote:

> I suspected that, and I also suspect that Apache is completely aware  
> of the link and only knows about /serve/www/lilwiki, so the Directory  
> directive never has any effect.

Interesting. Perhaps I got a false positive on my solution? I’ll try it  
and let you know.

Thanks!  
T.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 6, 2006, 6:46pm UTC](https://www.ruby-forum.com/t/setting-up-simple-cgi-on-ubuntu/71183/7 "2006-10-06T18:46:41Z")

</div>

Rick DeNatale wrote:

> > > #SetEnv RAILS\_ENV development  
> > >   
> > > Needs to be in the VirtualHost body, not the Directory body. Lovely, no  
> > > to
> 
> /home/trans/file/projects/PsyTower/lilwiki/public/
> 
> in the absense of any apparent Alias directive or anything else which  
> would cause Apache to look there.

Hmm… yea, guess that looks odd. But it’s just a symlink.

/serve/www/lilwiki/ =\>  
/home/trans/file/projects/PsyTower/lilwiki/public/

T.
