Score:0

Apache mod_action producing 404s

in flag

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 [email protected]
        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"
Score:0
bm flag

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>
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.