Configuring Apache
First, configuration file
Apache is a background running program without an interface. All configurations are included in the configuration file. The main configuration file is:
C: / program files / apache group / apache / conf / httpd.conf
If you want to modify the Apache configuration, you can edit this profile with any text editing tool (such as Notepad). In the configuration file, the line starting with "#" is a comment line.
Second, configuration options
The main options in the configuration file are as follows:
#Listen 3000 # listen 12.34.56.78:80
Apache's IP address and port. Generally, it is not necessary, Apache will be bound to the 80 port of all IP addresses of this unit.
Port 80
Apache's port. The default is 80.
ServerName User.dns0755.net
The name of the web server. "Server Name" entered during installation is saved here.
DocumentRoot "C: / Program Files / Apache Group / Apache / HTDOCS"
This is the root of the website. If you want to store the website file in the D: / MyWeb directory, you can modify the directory behind the DocumentRoot to "D: / MyWeb".
Options Indexes Followsymlinks MultiViews
For security, please delete the above "indexes". Otherwise, others can browse all the files in your site.
DirectoryIndex Index.html
The default home file name. When entering an address in the browser (for example http://user.dns0755.net/), Apache will find this default home file to open. If you want to configure multiple default home file names, use spaces.
Scriptalias / CGI-BIN / "C: / Program Files / Apache Group / Apache / CGI-BIN /"
CGI file storage path.
Third, advanced configuration
1, set the virtual directory
Find below in the configuration file:
Add below this line:
Alias / VDIR / "C: / comXe /"
This way, you can access the contents of the C: / COMEXE / directory by accessing http://user.dns0755.net/vdir/.
Apache has two virtual directories for default: "/ icons /" and "/ manual /". These two virtual directories are useless and can be removed in the configuration file.
2, how to solve Chinese webpages display garbled
(1) Looking for rows that contain "addlanguage" or "addcharset" in the configuration file, add a line in front of these rows:
AdddefaultCharset GB2312
(2) Develop good habits, join this line in
head> per page:The general Chinese version of the web editing tool (such as FrontPage, Dreamweaver, etc.) will automatically add this line.
3, how to solve the Chinese file name can't access
Select Tools in IE -> Internet Options -> Advanced -> Cancel "Always send URLs in UTF-8". This method is very troublesome, please try not to use Chinese website file name.
caution:
1. The most critical two points in the Apache configuration process are: Website root directory and default home file name. You must put the website file in the root directory of the specified website, and the default home file name must be set correctly, otherwise you will not see your web page.
2. After each configuration file changes, restart Apache will take effect.