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)
🐧 0 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |