Linux under the Apache+cgi configuration method. (Turn)---set cgi-bin__linux

Source: Internet
Author: User
1, install Apache
First download the latest version of Apache HTTP server to Apache's home page, address http://httpd.apache.org/
This article is written in 2006.4.29,apache version for 2.2.0. If you want to use this version, please click: http://mirror.vmmatrix.net/apache/httpd/httpd-2.2.0.tar.gz

Install Apache:
Switch to the httpd-2.2.0.tar.gz directory, and then:
# tar Xvzf httpd-2.2.0.tar.gz
At this point there is a folder httpd-2.2.0 in the directory, switch to the folder:
# CD./httpd-2.2.0
I don't know which folder you want to install Apache to, and we assume we want to install it under/usr/local/apache2/.
Enter the following command:
#./configure--prefix=/usr/local/apache2
# make
# make Install
After executing these 3 commands, Apache is installed in your/usr/local/apache2 directory.
Switch to the directory and see what you can do.
# CD./usr/local/apache2
# ls
You can see that there are/bin,/conf,/htdocs,/cgi-bin, and so on. Apache has not yet started, we start with the tool/bin in the Apachectl directory, first switch to the/bin directory:
# CD./bin
And then start:
#./apachectl Start
At this time, enter http://localhost/in the address bar to see if there is a successful message? (I see "it works!") The information, of course, different versions will be different, depending on the content of the index.html under your/htdocs.
Replace the/usr/local/apache2/htdocs/index.html with your paging file.

Here, we assume that your Apache server has been installed successfully. If you have any questions, please search the Internet or contact me:
Lonestep at Gmail D. T com

2, configure Apache to execute the CGI program
By default, the CGI program must be placed in the Cgi-bin directory, we first configure the CGI program under Cgi-bin to be properly executed,
The following will show you how to get Apache to execute a CGI program that is placed in a different directory.

1, on, we have to install Apache into the/usr/local/apache2 directory, switch to the/usr/local/apache2/conf directory, which has a httpd.conf file, edit this file:
# cd/usr/local/apache2/conf
# VI httpd.conf (assuming your text editor is VI, if you use another editor such as Emacs, Gedit, Kedit, and so on, replace VI with their command)
Find one line like this:
# scriptalias/cgi-bin/"/usr/local/apache2/cgi-bin/"
Remove the ' # ' in front of this line and restart Apache:
# CD./bin (or Cd/usr/local/apache2/bin)
#./apachectl Restart
OK, if you put a CGI program ' test.cgi ' to Cgi-bin, in the address bar
Enter http://localhost/cgi-bin/test.cgi to see if it can be executed.
If not, please email me:

2, if you want to change the execution of the CGI directory (without the default Cgi-bin directory), then the change just
scriptalias/cgi-bin/"/usr/local/apache2/cgi-bin/" is:
scriptalias/someotherdirectory/"/usr/local/apache2/cgi-bin/"
Then restart Apache.

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.