Description and Configuration Guide of httpd. conf file of ApacheServer
Source: Internet
Author: User
Article title: Comments and configuration instructions on httpd. conf files of ApacheServer. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
We made a simple comment on the httpdconf file. here we just put forward the comments to facilitate browsing.
If you want to view against the original article, we have prepared
Here is the httpdconf file zip, which is included in the comments on this page.
In order not to confuse files, I gave it another name: phpstarhttpdconf.
For more information, see http: // wwwapacheorg/docs /.
The following is a detailed description.
--------------------------------------------------------------------------------
Before:
1. when configuring and writing file names, note: If you give a file name that starts with "/", the server will use an absolute directory.
2. if the given file name does not start with "/", for example, "logs/foolog ",
The current server and directory are "/usr/local/apache /",
The server considers this log file as "/usr/local/apache/logs/foolog"
3. note: a slash "/" is used for all file names throughout the configuration process, rather than a backslash "".
For example, use "c:/apache" instead of "c: apache", which is different from DOS.
The configuration commands of the Apache server are not divided into three concentrated parts.
1. configure the environment variables of the Apache server throughout the running process.
2. configure detailed interface parameters for the master server or default server during runtime
3. set up a virtual server so that web requests with different IP addresses or different host names can be completed on the same Apache server.
That is, a physical server can be set to a virtual server with multiple IP addresses or multiple host names.
Part 1: environment settings
# Set the server startup mode: standalone or inetd.
# The default value is standalone ).
ServerType standalone
# Set the server directory to store the server's configuration files, error files, and record files.
# Note: The slash "/" cannot be added at the end of the Directory "/".
ServerRoot "C:/Apache"
# When the service program starts, it saves the process id of the parent program httpd to this
# Log/httpdpid file. The file name can be changed with the PidFile command.
PidFile logs/httpdpid
# Set the record file of the Apache server execution program.
ScoreBoardFile logs/apache_status
# The following two items are my preferences. if you think the httpdconf file is too long, you cannot find what you need.
# You can put the required settings in srmconf with only a few lines, and then open it below:
# The following two settings are enabled in the standard configuration. we can disable them.
# Remove "#" before the next line and enable srmconf
# ResourceConfig conf/srmconf
# AccessConfig conf/accessconf
# Maximum waiting time between the server and client
# If the client has not been connected in 300 seconds, or the server has not transferred data to the client in 300 seconds, it will be automatically disconnected. Timeout 300
# Set whether to support continuous data transfer. supported by default
KeepAlive On
# Set the number of support for continuous data transfer. The larger the quantity, the larger the hard disk space wasted, and the better the performance.
# If it is set to 0, there is no limit.
MaxKeepAliveRequests 100
# Set the maximum waiting time for continuous transfer
# If a connected user does not send a request to the server 15 seconds later, the user cannot use the resume function.
KeepAliveTimeout 15
# Set the number of sub-processes in the same time. for security purposes, set it to zero.
MaxRequestsPerChild 0
# Set the number of processes used by the server.
# This is based on the server's response speed. if the number is too large, it will slow down.
ThreadsPerChild 50
# Allow another Port or IP address to access the server. you can open it.
# Listen 3000.
# Listen 12345678: 80
# Set the IP address of the Apache listener, which is also the IP address of the virtual server on your local machine
BindAddress 127001
# Open a pre-activated module. do not change it unless you need it.
# LoadModule anon_auth_module modules/ApacheModuleAuthAnondll
# Set the status information generated by the server. If it is set to "On", detailed information is generated.
# ExtendedStatus On
--------------------------------------------------------------------------------
Part 2 detailed interface parameter settings
# Set the port used by the server for independent use.
Port 80
# Set the server manager's email address
ServerAdmin siron @ phpstarcom
# Server host name. If you have a fixed IP address, you do not need to set
ServerName localhost
# Set the directory for storing site html files
DocumentRoot "C:/Apache/htdocs"
# Set/directory commands. The details are as follows:
# Option: defines the operations that can be performed in the directory.
# None indicates browsing only
# FollowSymLinks allows the page to be connected elsewhere,
# ExecCGI allows CGI execution,
# MultiViews allows operations such as watching animations or listening to music,
# Indexes allows the server to return a formatted list of directories,
# Supported des allows SSI.
# You can check these settings. All can do anything, but does not include MultiViews.
# AllowOverride:
# Adding the "None" parameter indicates that anyone can browse the files in this directory but will not read the files.
# FileInfo allows the use of commands that control file types,
# AuthConfig allows the use of authentication commands,
# Indexes allows the use of directory index commands,
# Limit allows the use of commands for controlling access to hosts,
# Options allows you to control the use of commands specific to directories
# If it is set to All, the server will allow All commands
Ptions FollowSymLinks
AllowOverride None
# Define the first file to be displayed.
# You can change DirectoryIndex indexhtml indexhtm in this way
DirectoryIndex indexhtml
# Define the name of each directory access control file
AccessFileName htaccess
# Define proxy server not to cache your page by default not used
# CacheNegotiatedDocs
# This command sets the location of the mime type configuration file,
# The file name is relative to ServerRoot. We do not recommend that you change this file.
TypesConfig conf/mimetypes
# The server will record the error message to a record,
# The file name can be set using the ErrorLog command.
# Different error records can be set for different virtual hosts
ErrorLog logs/errorlog
# Set the record format
LogFormat "% h % l % u % t" % r "%> s % B" common
# Alias commands allow files to be stored in a local file system other than DocumentRoot
# The ScriptAlias command is the same as the Alias command, but it also indicates that the directory contains the CGI or PHP command file.
# The AddType command uses the specified content type as the sub-file name of the file ending with the file name
Alias/icons/"C:/Apache/icons /"
Alias/test/"c:/php/test /"
Alias/admin/"c:/admin/phpMyAdmin /"
ScriptAlias/php/"c:/php /"
AddType application/x-httpd-php
AddType application/x-httpd-php3 php3
Action application/x-httpd-php "/php/phpexe"
# AddIcon, AddIconByEncoding and AddIconByType
# Is used to set the graph list used to display different file types. for each column
# The output file type. the first matching graph is displayed.
AddIconByType VID,/icons/moviegif video/
AddIcon/icons/binarygif bin exe
# If a problem or error occurs, you can configure Apache for four responses.
#1 output custom message text
# ErrorDocument 500 "The server made a boo
#2 re-import a local URL to solve this problem/error
# ErrorDocument 404/missinghtml
# ErrorDocument 404/cgi-bin/missing_handlerpl
#3 re-import an external URL to handle this issue/error
# ErrorDocument 402 http: // someother_servercom/subscription_infohtml
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.