Menu

How To Enable or Disable CGI Scripts in Apache 2.4


Apache Module mod_cgi/mod_cgid is responsible for handling of CGI Scripts. for worker and event multi-threaded MPM uses cgi daemon “mod_cgid” module. This tutorial will help you to how to enable or disable CGI script in Apache 2.4 server on Linux operating systems.
1. Enable CGI Module in Apache
To enable CGI in your Apache server. you need to Load module file mod_cgi.so or mod_cgid.so in your Apache configuration file.

CentOS, RHEL & Fedora Users –

On CentOS, Red Hat, Fedora and other rpm based distributions edit/etc/httpd/conf.modules.d/XX-cgi.conf configuration file and make sure below showing lines are not commented.
<IfModule mpm_worker_module>
   LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_event_module>
   LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
   LoadModule cgi_module modules/mod_cgi.so
</IfModule>

Ubuntu, Debian & LinuxMint Users –

Ubuntu, Debian, LinuxMint and other Debian derivatives use following command to enable CGI module. This command creates a soft links of module configuration file to /etc/apache2/mod-enabled/ directory.
$ sudo a2enmod cgi
After enabling CGI modules in Apache configuration you need to restart Apache service on your system for changes take effect.

2. Disable CGI Module in Apache

We recommend to keep CGI disabled on your server until its recommended for your server. CGI scripts are are used by hackers to attack on servers. Use below options to disable cgi script on your Apache server.

CentOS, RHEL & Fedora Users –

CentOS, Red Hat, Fedora and other rpm based distributions rename/etc/httpd/conf.modules.d/XX-cgi.conf configuration file like below.
$ mv /etc/httpd/conf.modules.d/XX-cgi.conf /etc/httpd/conf.modules.d/XX-cgi.conf.disable

Ubuntu, Debian & LinuxMint Users –

Ubuntu, Debian, LinuxMint and other Debian derivatives use following command to disable CGI module.
$ a2dismod cgi
After disabling CGI modules you need to restart Apache service on your system for changes take effect.
http://www.hackthesec.co.in
http://www.twitter.com/hackthesecurity
https://www.facebook.com/htsecu

About Author:


I am a Linux Administrator and Security Expert with this site i can help lot's of people about linux knowladge and as per security expert i also intersted about hacking related news.TwitterFacebook

Next
Newer Post
Previous
Older Post

0 comments:

Post a Comment

 
Top