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.