How do I find the url for my cgi-bin?
The CGI is acronym for Common Gateway Interface. It is a standard for interfacing external applications with Apache Web servers. A CGI program is executed in real-time, so that it can output dynamic information. It can be written in Perl, Php, Bash, C/C++ or other programming languages. But how do I find the url for my cgi-bin? It's not in my /var/www/ directory.
Apache web server use ScriptAlias directive defines cgi-bin directory that contain server scripts. You can use open Apache web server configuration file using text editor such as vi and look for ScriptAlias directive:
httpd.conf file location:
Debian Linux:
$ vi /etc/apache-perl/httpd.conf
Red Hat/ Fedora Core Linux:
$ vi /etc/httpd/conf/httpd.conf
FreeBSD:
$ vi /usr/local/etc/httpd.conf
You can also use grep command as follows to find out your cgi-bin directory:
$ grep 'ScriptAlias' /etc/httpd/conf/httpd.conf
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
/usr/lib/cgi-bin/ is cgi-bin directory. If you have public_htm directory then cgi-bin directory should be inside this directory. Once you located cgi-bin directory you can use it.
Default cgi-bin directory locations:
- Red Hat Linux: /var/www/cgi-bin/
- Fedora Linux: /var/www/cgi-bin/
- Debian Linux: /usr/lib/cgi-bin/
- FreeBSD: /usr/local/www/cgi-bin/
Finally your url location depends upon directory location. You can use http://ip-address/cgi-bin or http://ip-address/~yourname/cgi-bin (replace ip-address with your domain name)
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Linux / UNIX FAQ:
- Find files that do not have any owners or do not belong to any user under Linux/UNIX
- Linux: How can I find a file on my system?
- Finding files in Linux filesystems
- Linux or Unix find and remove files with one find command on fly
- How do I search my Linux / UNIX server for a file?
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!
~ Last updated on: August 28, 2006


Recent Comments
Today ~ 7 Comments
Yesterday ~ 9 Comments
Yesterday ~ 3 Comments
Yesterday ~ 1 Comment
05/10/2008 06:08 pm (2 days ago) ~ 7 Comments