How to Make cPanel / WHM Servers More Secure?
1) Apache / PHP Suexec: Known as more secure management for PHP. It also allows…
CGI (Common Gateway Interface) scripts allow you to run programs or scripts (such as .cgi, .pl, or .py) on your web server to generate dynamic content. By default, many servers only allow CGI scripts in the cgi-bin directory, but you may want to enable CGI for a specific folder within your hosting account.
This guide will show you how to enable CGI in any folder using a .htaccess file.
cgi-bin is a directory where servers typically store executable CGI scripts.
These scripts can perform tasks like form processing, database connections, and generating dynamic web pages.
Enabling CGI for other folders gives developers more flexibility in organizing their web applications.
1. Create a .htaccess File
In the folder where you want to enable CGI, create a new file named: “.htaccess“
2. Add Execution Permission
Insert the following directive in the .htaccess file:
“Options +ExecCGI”
3. Define CGI Handlers
Add the handlers for CGI scripts so that the server knows how to process them:
“AddHandler cgi-script .cgi .pl”
4. (Optional) Update Apache Config
If your setup requires additional configuration, you can update the Apache config file:
Include /etc/httpd/conf/site#/enable-cgi
Options +ExecCGI
5. Restart Apache
For changes to take effect, restart the Apache service:
systemctl restart httpd
By creating a .htaccess file and adding the right directives, you can enable CGI-bin functionality for any folder on your server. This allows more flexibility in running scripts and building dynamic web applications. Always remember to set correct file permissions and follow security best practices while working with CGI.
Explore more hosting insights, tips and industry updates.
1) Apache / PHP Suexec: Known as more secure management for PHP. It also allows…
This guide walks you through installing Asterisk on a fresh Fedora Core system. Make sure…
Here, in this article, we will learn how to allow the customers Compiler Access using…