• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

I wish to enable CGI on on my redhat ES box


I wish to enable CGI on my REDHAT box  what configuration changes installs do i need to make.

as i wish to setup squid cache manager.


1 Solution
Hi Jason

To enable cgi

Open httpd.conf and find AddHandler uncomment and add

  AddHandler cgi-script .cgi

This tells Apache that files with extensions .cgi  must be executed.

A quick comment to the above - after making changes,  be certain to restart Apache so that it reads the configuration file. :)
pretty much there is two ways of doing it:

1.  By ScriptAlias (http://httpd.apache.org/docs-2.0/mod/mod_alias.html#scriptalias)
  This method would cause everything in the directory defined in ScriptAlias to be CGI (to be executed by the server).
2.  By setting special handler (just like Ronan mentioned), AddHandler (http://httpd.apache.org/docs-2.0/mod/mod_mime.html#addhandler)
  This method would only cause files defined by AddHandler directive to be executed (as what ronan mentioned, anything with .cgi extension would be excuted), BUT... you would need to add +ExecCGI in the Option directive for the respective folder that you need the file to be executed.  For example, if you had

AddHandle cgi-script .cgi .pl

Alias /somepath /some/path
<Directory /some/path>
   Options +ExecCGI

Alias /anotherpath /another/path
<Directory /another/path>
   Options -ExecCGI

Those .pl and .cgi file in /some/path will be executed as CGI but those in /another/path would not.  And again, you would need to check the global definition <Directory />..</Directory>.. which in most case would not defined ExecCGI, for some reason.

More information:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now