Apache2 in Ubuntu supports CGI

Source: Internet
Author: User

From: http://www.5dlinux.com/article/9/2008/linux_16538.html

I use C language for CGI. Originally, CGI was required in an embedded system, which contains the Boa Server (configure the boa to support CGI in my next article ). First, learn to use CGI on a PC. The PC system is unbuntu7. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.