Install Apache
1. Download
You can download Apache for Windows from this website:
Http://nagoya.apache.org/mirror/httpd/binaries/win32/
Apache has two branches: 1.3.x and 2.0.x. You can use 1.3.x for beginners. This article takes 1.3.x as an example.
The above URL contains the latest versions of the two branches. Download the installation file with the suffix "EXE" or "Msi.
Ii. Installation
Run the downloaded Apache file to start installation. The Installation Process of Apache is very simple. You only need to set the following window:
Enter the domain in "network domain. If you use the second-level domain name of this site, such as "test.dnschek.net", enter "test.dnschek.net ". If you use a top-level domain name, enter "xxx.com ".
Enter the server name in "server name. If you use the second-level domain name of this site, enter your domain name "test.dnschek.net ". If you use a top-level domain name, enter "www.xxx.com ".
In "Administrator @ # s email address", enter the email address of the website administrator.
In addition, you can use the default options for all the options during the installation process.
Iii. Running
1. Win 9x:
After Apache is installed,ProgramAdd an Apache HTTP Server group. Go to the group and select "control Apache server"> "start" to start Apache.
2. Win NT/2000/XP/2003
In these systems, apart from adding an Apache HTTP Server group to "start"-> "program" by default, an apache service will also be added to the system service. This service is set to run automatically when the system starts.
Configure Apache
1. Configuration File
Apache is a backend program with no interface. All configurations are included in the configuration file. The main configuration file is:
C: \ Program Files \ apache group \ apache \ conf \ httpd. conf
To modify Apache configuration, you can use any text editing tool (such as NotePad) to edit the configuration file. In the configuration file, the line starting with "#" is a comment line.
Ii. 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. Generally, you do not need to set it. Apache is bound to port 80 of all the IP addresses of the local machine.
Port 80
Apache port. The default value is 80.
Servername test.dnschek.net
The name of the Web server. The "server name" entered during installation is saved here.
DocumentRoot "C:/program files/Apache Group/Apache/htdocs"
This is the root directory of the website. If you want to store website files in the "D: \ myweb" directory, you can change the directory after DocumentRoot to "D:/myweb ".
Options indexes followsymlinks Multiviews
To ensure security, delete the above "indexes. Otherwise, you can browse all the files on your website.
Directoryindex index.html
Default homepage file name. When you enter an address (such as http://test.dnschek.net/) in a browser, Apache looks for this default homepage file to open. If you want to configure multiple default homepage file names, separate them with spaces.
ScriptAlias/cgi-bin/"C:/program files/Apache Group/Apache/cgi-bin /"
CGI File Storage path.
Iii. Advanced Configuration
1. Set a virtual directory
Find the following line in the configuration file:
<Ifmodule mod_alias.c>
Add the following content under this line:
Alias/vdir/"C:/comexe /"
<Directory "C:/comexe/">
Options Multiviews
AllowOverride none
Order allow, deny
Allow from all
</Directory>
In this way, access http://test.dnschek.net/vdir/to access the content in the c:\test\directory.
Apache opens two virtual directories by default: "/icons/" and "/manual /". These two virtual directories are useless and can be deleted from the configuration file.
2. How to solve Chinese webpage display garbled characters
(1) Find the row that contains "addlanguage" or "addcharset" in the configuration file and add a line at the beginning of these rows:
Adddefacharcharset gb2312
(2) develop good habits and add this line to
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
This line is automatically added to common Chinese Version Web editing tools (such as FrontPage and Dreamweaver.
3. How can I solve the problem of inaccessible Chinese file names?
In IE, choose tool-> Internet Options-> advanced-> cancel always send URL with UTF-8 ".
This method is very troublesome. Please try not to use Chinese website file names.
Note:
1. The most important two points in the Apache configuration process are the website root directory and default homepage file name. You must put the website file in the specified root directory of the website, and the default homepage file name must be set correctly. Otherwise, Your webpage will not be visible.
2. After each configuration file change, it takes effect only after Apache is restarted.