<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.define-technology.com/mediawiki-1.35.0/index.php?action=history&amp;feed=atom&amp;title=Redhat%3A_Apache_CGI_scripts</id>
	<title>Redhat: Apache CGI scripts - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.define-technology.com/mediawiki-1.35.0/index.php?action=history&amp;feed=atom&amp;title=Redhat%3A_Apache_CGI_scripts"/>
	<link rel="alternate" type="text/html" href="http://wiki.define-technology.com/mediawiki-1.35.0/index.php?title=Redhat:_Apache_CGI_scripts&amp;action=history"/>
	<updated>2026-05-04T22:49:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>http://wiki.define-technology.com/mediawiki-1.35.0/index.php?title=Redhat:_Apache_CGI_scripts&amp;diff=3285&amp;oldid=prev</id>
		<title>Michael: Created page with &quot;== Deploy a CGI script ==  This is easier than it sounds as no programming experience is required and all of the instructions can be found in the httpd manuals.  == Apache con...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.define-technology.com/mediawiki-1.35.0/index.php?title=Redhat:_Apache_CGI_scripts&amp;diff=3285&amp;oldid=prev"/>
		<updated>2013-08-25T11:41:29Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Deploy a CGI script ==  This is easier than it sounds as no programming experience is required and all of the instructions can be found in the httpd manuals.  == Apache con...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Deploy a CGI script ==&lt;br /&gt;
&lt;br /&gt;
This is easier than it sounds as no programming experience is required and all of the instructions can be found in the httpd manuals.&lt;br /&gt;
&lt;br /&gt;
== Apache config for CGI ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
LoadModule cgi_module&lt;br /&gt;
ScriptAlias /cgi-bin/ &amp;quot;/var/www/cgi-bin&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First the cgi module must be loaded.   The second directive points apache to look for scripts in &amp;lt;hostname&amp;gt;/cgi-bin/&lt;br /&gt;
&lt;br /&gt;
By default the directory container does not allow for executable scripts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;directory /var/www/cgi-bin&amp;gt;&lt;br /&gt;
        AllowOverride None&lt;br /&gt;
        Options None&lt;br /&gt;
        Order allow,deny&lt;br /&gt;
        Allow from all&lt;br /&gt;
&amp;lt;/directory&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some changes must be made to  allow CGI scripts to be exectuted:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;directory /var/www/cgi-bin&amp;gt;&lt;br /&gt;
        AllowOverride None&lt;br /&gt;
        Options ExecCGI&lt;br /&gt;
        AddHandler cgi-script .pl&lt;br /&gt;
        Order allow,deny&lt;br /&gt;
        Allow from all&lt;br /&gt;
&amp;lt;/directory&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== A simple CGI script ==&lt;br /&gt;
&lt;br /&gt;
This is the example script hello.pl from the httpd-manuals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
print &amp;quot;Content-type: &amp;quot;text/html\n\n&amp;quot;;&lt;br /&gt;
print &amp;quot;Hello World&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the permissions to 755 using chmod. The SELinux context should be inherited from the /var/www/cgi-bin directory.   &lt;br /&gt;
&lt;br /&gt;
Once this is all set up, you can point your browser towards the cgi script you should see the output of the script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
http://boston1.example.com/cgi-bin/hello.pl&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Michael</name></author>
	</entry>
</feed>