Discover Steps to Sync Two Apache Web Servers Using Rsync
Do you have a mirrored server of your current server to take the backup when…
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.
Do you have a mirrored server of your current server to take the backup when…
In this Knowledge Base you will understand what exactly TLS/SSL is? TLS/SSL Certificate? And what…
In Linux, it’s important to monitor the size of your directories to manage disk space…