Setting Up Gentoo Apache for CGI and Perl

Description

There are a few things that need to be done to set up apache2 to run a CGI bin directory so you can run perl scripts. The first is to set apache modules and then then configure the apache vhost conf file.

Setting Up Modules

I edit my /etc/make.conf file to keep all my modules for the my apache installation.

#/etc/make.conf
APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache    env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias proxy cgi cgid"

Setup Vhost conf file

These are the things you need to setup your apache vhost conf

ScriptAlias /cgi-bin/ "/var/www/zaphinath/cgi-bin/"
AddHandler cgi-script .cgi .pl

<directory /var/www/yourdirectory/>
  Options Indexes FollowSymLinks ExecCGI
  AllowOverride All
  Order allow,deny
  Allow from all
</Directory>

So that now all you have to do is make sure you run the following commands to make sure your apache is reconfigured and vhosts is set up.

emerge -av apache
apachectl graceful

Comments are closed.