Detailed description of the apache configuration file in linux

Source: Internet
Author: User
Tags mime file squirrelmail
Article Title: Detailed description of the apache configuration file in linux. 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.

### Section 1: Global Environment
// The Apache version and operating system name are displayed when the server responds to the Host header information.
ServerTokens OS
// Set the root directory of the server
ServerRoot "/etc/httpd"
  
# ScoreBoardFile run/httpd. scoreboard
  
// Set the PidFile path used to run Apache
PidFile run/httpd. pid
  
// If no data is received or sent in 300 seconds, the connection is closed.
Timeout 300
  
// The Persistence function is not used, that is, the client can only respond to one file at a request
/We recommend that you set the value of this parameter to On, that is, the function of retaining connections is allowed.
KeepAlive Off
  
// When using the keep connection function, set the maximum number of files that can be responded to by one request.
MaxKeepAliveRequests 100
  
// When the connection persistence function is used, the two adjacent connections are disconnected after an interval of more than 15 seconds.
KeepAliveTimeout 15
  
##
# Server-Pool Size Regulation (MPM specific)
##
# Prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
// Set parameters for using the Prefork MPM running mode. The running mode is the default mode of Red hat.
  
  
// Set the number of processes that run when the server is started
StartServers 8
  
// Apache automatically adjusts the number of idle sub-processes according to the weight of the load during running.
// If there are less than five idle sub-processes, create a new sub-process to provide services to the customer.
MinSpareServers 5
  
// If more than 20 idle sub-processes exist, create and delete sub-processes one by one to improve system performance.
MaxSpareServers 20
  
// The number of connections at the same time cannot exceed 150
MaxClients 150
  
// Limit the number of connection requests that each sub-process can process before processing the request ends to 1000.
MaxRequestsPerChild 1000
  
  
# Worker MPM
# StartServers: initial number of server processes to start
// Set parameters for running Worker MPM
  
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
  
  
# Perchild MPM
# NumServers: constant number of server processes
// Set parameters for running with perchild MPM
  
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
  
  
// Set the listening port of the server
# Listen 12.34.56.78: 80
Listen 202.112.85.101: 80
  
#
# Load config files from the config directory "/etc/httpd/conf. d ".
// Include all configuration files ending with conf in the/etc/httpd/conf. d directory
Include conf. dpublic_html>
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
#
# Order allow, deny
# Allow from all
#
#
# Order deny, allow
# Deny from all
#
#
  
// When the server is running, search for page index.html index.htm. var.
DirectoryIndex index.html. var
  
// Specify the name of the protected directory configuration file
AccessFileName. htaccess
  
// Deny access to files starting with. ht, that is, ensure that. htaccess is not accessed
  
Order allow, deny
Deny from all
  
  
// Specify the storage location for configuration files that process MIME-specific formats
TypesConfig/etc/mime. types
// Specify the default MIME file type as a plain text or HTML file
DefaultType text/plain
  
// When the mod_mime_magic.c module is loaded, specify the storage location of the magic information code configuration file.
  
# MIMEMagicFile/usr/share/magic. mime
MIMEMagicFile conf/magic
  
  
// Only record the IP address connected to the Apache server, not the host name
HostnameLookups Off
// Specify the location where error logs are stored
ErrorLog logs/error_log
// The detailed level of error information recorded is warn.
LogLevel warn
// Define the log format in Step 4
LogFormat "% h % l % u % t" % r "%> s % B" % {Referer} I "" % {User-Agent} I "" combined
LogFormat "% h % l % u % t" % r "%> s % B" common
LogFormat "% {Referer} I-> % U" referer
LogFormat "% {User-agent} I" agent
  
// Specify the access log record format as combined (hybrid) and the location where the access log is stored
# CustomLog logs/access_log common
CustomLog logs/access_log combined
# CustomLog logs/referer_log referer
# CustomLog logs/agent_log agent
# CustomLog logs/access_log combined
  
// Set the signature of the apache server version on the page generated by apache itself
ServerSignature On
  
// Set the access alias of the content negotiation directory
Alias/icons/"/var/www/icons /"
// Set/var/www/icons/Access Permissions
  
// MultiViews uses content negotiation to determine the nature of the webpage to be sent
Options Indexes MultiViews
AllowOverride None
Order allow, deny
Allow from all
  
  
// Set the webpage email service
Alias/webmail "/usr/share/squirrelmail"
  
  
Options Indexes MultiViews
AllowOverride None
Order allow, deny
Allow from all
  

[1] [2] [3] Next page

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.