Delan Azabani
Delan Azabani

Reputation: 81412

Configure Apache to run ELF executables

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.

Upvotes: 3

Views: 1617

Answers (1)

Alex Howansky
Alex Howansky

Reputation: 53581

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>

Upvotes: 1

Related Questions