Where is cgi-bin in Linux?
Emily Wilson
Updated on March 03, 2026
Where is cgi-bin in Linux?
/usr/lib/
Default cgi-bin directory locations: Red Hat Linux: /var/www/cgi-bin/ Fedora Linux: /var/www/cgi-bin/ Debian Linux: /usr/lib/cgi-bin/
Where is Apache cgi-bin?
If you look in the /var/www (the document root of Apache), you will find a sub-directory called cgi-bin. This is not where your Perl programs and other various files will be placed. Within the /usr/lib/ directory, you will find another cgi-bin directory; it is the repository for your executables.
What is Apache cgi-bin?
The CGI (Common Gateway Interface) defines a way for a web server to interact with external content-generating programs, which are often referred to as CGI programs or CGI scripts. It is a simple way to put dynamic content on your web site, using whatever programming language you’re most familiar with.
How do I enable cgi-bin?
Enable CGI Scripts in the Apache Configurations
- sudo nano /etc/httpd/conf/httpd.conf.
- # # “/var/www/cgi-bin” should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <
- Options +ExecCGI AddHandler cgi-script .cgi .pl .py.
How do I open a CGI file in Linux?
Programs that open or reference CGI files
- File Viewer Plus. Notepad++ Richardson EditRocket. Microsoft Notepad. Included with OS. gVim. Other text editor.
- Bare Bones BBEdit. MacroMates TextMate. Richardson EditRocket. Other text editor.
- Linux. Richardson EditRocket. Other text editor.
How do I run CGI script in Apache?
Enable server-wide execution
- Connect to your server as root or a sudo user via SSH.
- Open the httpd.conf file for editing: vi /etc/httpd/conf/httpd.conf. vi tip:
- Locate this line: Filename: httpd.conf #AddHandler cgi-script .cgi.
- Restart Apache with the following command: /etc/rc.d/init.d/httpd restart.
How does CGI-bin work?
CGI (Common Gateway Interface) is a standard way of running programs from a Web server. Basically, CGI works like this: A reader sends a URL that causes the AOLserver to use CGI to run a program. The AOLserver passes input from the reader to the program and output from the program back to the reader.
How do I create a CGI-bin folder?
Open your Filezilla program and connect to your website. When you are in your top-level directory, (Where you see “public_html”) Right-click anywhere in the the window and select “create directory.” Simply name the directory “cgi-bin” You’re done!
How do I open a CGI file?
You can open the CGI script in Chrome by right-clicking its PDF and selecting Open with. Select to open it with the Google Chrome browser. You can also open the document with alternative PDF software, such as Adobe Acrobat and Foxit.
How do I create a CGI bin folder?
Is CGI still used?
It simply is not up to the challenges of modern web applications and the onerous security environment of today. Unfortunately, many embedded devices still use CGI today.
Where are CGI scripts stored?
cgi-bin
The folder for CGI scripts is what we call the cgi-bin. It is created in the directory root of your website and where your scripts are permitted to run or execute. The cgi-bin folder will store the scripts such as Perl (. pl) that your website will use.
What is the cgi-bin used for?
A CGI-bin is a folder used to house scripts that will interact with a Web browser to provide functionality for a Web page or website. Common Gateway Interface (CGI) is a resource for accommodating the use of scripts in Web design. As scripts are sent from a server to a Web browser, the CGI-bin is often referenced in a url.
How to create a ‘cgi-bin’ directory?
How to Create a ‘cgi-bin’ Directory Step One: Customize Your App’s Apache Vhost Configuration To enable CGI scripts for an app, SSH in to your server as… Step Two: Create and Test the cgi-bin Directory
What is Common Gateway Interface?
The Common Gateway Interface is an agreement between HTTP server implementors about how to integrate such gateway scripts and programs. It is typically used in conjunction with HTML forms to build database applications. See also: WWW and OOP for more on building distributed applications on the web.
How to run CGI scripts?
The browser requests the URL in the ACTION tag and passes all the data along with the request.