tags:

views:

40

answers:

1

I've searched for this for a while but have not been able to find a solution. How can I configure Apache to run any ELF executable in the web root as a CGI program? For example, if I write and compile a C program and place it as /var/www/something, I want to be able to visit http://localhost/something and have Apache run the program, outputting the result, instead of prompting me to download the binary.

Edit: I know how to run CGI programs, and those outside of cgi-bin, I just want to find out how to run ELF executables with no extension such as .cgi, possibly using Apache to detect the magic of the file.

+1  A: 

How about using the files directive to whitelist your executable names?

<files something>
  SetHandler cgi-script
</files>

Or better, can you put all your executables into a single known subdirectory?

<location /exec>
  SetHandler cgi-script
</location>
Alex Howansky
No support just for detecting the ELF's magic?
Delan Azabani
I think you might be able to use mod_mime_magic for this, but I didn't have time to investigate very far into it.
Alex Howansky