0

I'm trying to setup a custom action handler for certain files in Apache (running on Ubuntu). It looks to me like I have my site config setup correctly for the action handler, but now when ever I access any file handled by it, it 404s.

If I remove the action handler, the file 200s as text as expected, so the file really is there.

Here is the site config:

<VirtualHost *:80>
        ServerName foo.com
        ServerAdmin foo@bar.com
        DocumentRoot /home/foo/www

        AddHandler application/x-httpd-php .php .php3 .php4 .php5 .html .htm

        Action test-script "/usr/lib/cgi-bin/tts.cgi"
        AddHandler test-script .tts
</VirtualHost>

<Directory "/home/foo/www">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

And here is the test script that I'm expecting to be executed when I hit any tts file:

#!/bin/bash
printf "Content-type: text/html\n\n"
printf "Hello World!\n"
Adam
  • 101
  • 3

1 Answers1

0

First, make sure you enable the CGI module using :

a2enmod cgid

and try add AddHandler above Action

AddHandler test-script .tts
Action test-script "/usr/lib/cgi-bin/tts.cgi"

If you want to run CGI script, just use config like below:

<Directory "/var/www/html/cgi">
    Options +ExecCGI
    AddHandler cgi-script .cgi .pl .py .rb
</Directory>