Python Web Environment related

Source: Internet
Author: User
Tags apache error log

I. Apache configuration and Support CGI

1. Configuration files

Apache is a program running in the background with no interface. All configurations are included in the configuration file. The main configuration file is:
~\apache\conf\httpd.conf
If you want to modify the configuration of Apache, you can edit the configuration file with any text editing tool (such as Notepad). In the configuration file, lines that begin with "#" are comment lines.

2. Configuration options

The main options in the configuration file are as follows:
#Listen 3000
#Listen 12.34.56.78:80
The IP address and port of Apache. In general, no settings are required, and Apache binds to port 80 on all IP addresses on this computer.
Port 80
Apache Port. The default value is 80.
ServerName test.dnschek.net
  The name of the Web server. The "Server Name" entered at the time of installation is saved here.
DocumentRoot "C:/Program Files/apache group/apache/htdocs"
This is the root directory of the Web site. If you want to store the Web site files in the "D:\myweb" directory, you can change the directory behind DocumentRoot to "D:/myweb".

Directory access control, because it's a test, it's all open.

<directory "D:/apache2.2/cgi-bin" >
AllowOverride Options
Order Allow,deny
Allow from all
Options +execcgi
# AddHandler Cgi-script. cgi. pl. exe
</Directory>

Options Indexes followsymlinks MultiViews
For safety reasons, please delete the "Indexes" above. Otherwise, people can browse to all the files on your site.
DirectoryIndex index.html
Default home file name. When you enter an address in the browser (for example, http://test.dnschek.net/), Apache will look for the default home file to open. If you want to configure multiple default home page filenames, separate them with a space.

LoadModule cgi_module modules/mod_cgi.so //Must be loaded

Then set the CGI run directory, of course, you can specify a directory directly to make it php,cgi, but now only start, purely point.

scriptalias/cgi-bin/"d:/apache2.2/cgi-bin/" in this general file, you change the address.

This is said in the root directory cgi-bin This directory is access to the d:/apache2.2/cgi-bin/inside the file.

The following sets the permissions of the CGI directory, can be run CGI program suffix name can not be set here, here is set only in this folder with the suffix name. It is important to enable this directory to run CGI programs and add options +execcgi

<directory "D:/apache2.2/cgi-bin" >
AllowOverride Options
Order Allow,deny
Allow from all
Options +execcgi
# AddHandler Cgi-script. cgi. pl. exe
</Directory>

Add the following in the <ifmodule mime_module>, all the files that can be run suffix are put here, find convenient.

AddHandler cgi-script. exe. pl. CGI

Common errors:

CGI does not execute, Apache error log: Premature end of script headers, or malformed header from script. Bad headerxxx, in this case, check out the first sentence of the CGI output. Should be shaped like:
content-type:text/html\n\n
Note: Two blank lines are to be output after the declaration of a good content-type.

Python Web Environment related

Related Article

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.