Configure apache2 + FastCGI in Ubuntu

Source: Internet
Author: User

I have been studying programming in UNIX environments recently and decided to write several FastCGI codes in C. Program And strive for future use C Language Allows you to access gadgets such as embedded devices and PDAs through a browser ~ It will be interesting.

The configuration record of FastCGI in Ubuntu is as follows:

The most attractive part of Ubuntu is its convenient package management tool apt. With the powerful tool apt, we can easily find and install the required software packages.

Enter

Sudo apt-Get install apache2

Install apache2

Enter

Sudo apt-Get install libapache2-mod-fastcgi

APT automatically downloads and installs Apache and FastCGI modules.
Restart Apache or, in/etc/init. D contains the Apache STARTUP script. If you want to disable automatic startup of Apache, you can set the rcX under/etc. d. Delete the Apache Symbolic Link (X is a number ranging from 0 to 6, indicating different startup levels. For more information, see the reference manual)

It's very simple, but it's not over yet.

If you plan to develop the FastCGI program, you 'd better install the FastCGI development component.

Sudo apt-Get install libfcgi-Dev

Then you need to modify the configuration file. Otherwise, it will be difficult to execute the CGI program ....
403 insufficient permissions for errors
After studying for a long time, the final solution is as follows:
Modify/etc/sites-available/Default
In
<Directory/> and
Add the <directory/var/www/> Block

Options + execcgi

This grants the execution permission.

At this point, the FastCGI platform has been set up.
We can compile a program experiment.
Get example/echo. C from the Development Kit .....

Gcc-I/usr/local/include/FastCGI-C echo. c

Gcc-O echo. fcgi echo. O-L/usr/local/lib-lfcgi

It should be noted that in Ubuntu or Debian, Apache configuration files are "scattered"

There are n files in/etc/apache2. In fact, these files split the original httpd. conf file by function, for example:
Only one line exists in ports. conf.
Listen 80
You know what it is ~~ Haha

Apache2.conf is the main configuration file, which contains most of the original content of httpd. conf, including various Server parameters.

Module management is placed in/etc/apache2/mod-enable
Including our lovely fcgi

It is not difficult to deduce the role of other configuration files ~ Just take a closer look ~

This is a basic introduction. I hope it will be helpful to anyone who needs it.

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.