perlapachecgifoswiki

500 errors for images used by Perl CGI application


I've installed Foswiki but I've problem when my app try load images. The images don't load...

I've get a solution but I'm not sure if is correct ...

This is my configuration for CGI directory

#
# "C:/Archivos de programa/Apache Software Foundation/Apache2.2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "C:/Archivos de programa/Apache Software Foundation/Apache2.2/cgi-bin">
    AllowOverride All
    Options +ExecCGI 
    AddHandler cgi-script .cgi .pl
    AddHandler default-handler .jpg .png .gif .js .txt .bat .css 
    Order allow,deny
    Allow from all
</Directory>

I have to add the extensions one by one :(...


Solution

  • Going out on a bit of a limb here, but I'm guessing that, in addition to the configuration included in your question, this directory is also the target of a ScriptAlias directive (probably for /cgi-bin, and possibly in the default Apache configuration rather than in something you've explicitly done). ScriptAlias says that every file in the directory is a CGI script; see the directive documentation. That's why you have to override that behavior with AddHandler.

    If you want to control which files are executed as CGI scripts using AddHandler with file extensions like .cgi, don't use ScriptAlias. Without ScriptAlias, the default will be to serve the file out as a resource unless you explicitly say to execute it as a CGI script.