How do I find the url for my cgi-bin?

by on January 14, 2006 · 0 comments· LAST UPDATED August 28, 2006

in , ,

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)

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 0 comments… add one now }

Leave a Comment

Tagged as:

Previous Faq:

Next Faq: