I use C language for CGI. Originally, CGI was required in an embedded system, which contains the BOA Server. First, learn to use CGI on a PC. The PC system is Ubuntu7.04. First install The apache2 server. # Sudoapt-getinstallapache2 configuration file directory in/etc/apache2/sites-enabled/000-default # vi/etc/apache2/sites-enabled/000
I use C language for CGI. Originally, CGI was required in an embedded system, which contains the BOA Server. First, learn to use CGI on a PC. The PC system is Ubuntu7. 04.
First install The apache2 server.
# Sudo apt-get install apache2
The configuration file directory is in/etc/apache2/sites-enabled/000-default.
# Vi/etc/apache2/sites-enabled/000-default
Modify the following two sentences:
DocumentRoot/var/www/html
ScriptAlias/cgi-bin // var/www/html/cgi-bin/
DocumentRoot is followed by a directory containing HTML files. Access http: // 127.0.0.1 /???. Html.
ScriptAlias is followed by/cgi-bin/to/var/www/html/cgi-bin /. Access 127.0.0.1/cgi-bin/??? in the browser /???.
You can set these two directories by yourself.
After the modification is completed, restart apache2.
#/Etc/init. d/apache2 restart
Note that the CGI program attribute must be set to run (755). If the directory of the CGI-related HTML file is to be written by the CGI program, the permission must be set to writable (666 ).
Now your CGI program can run.