There are two types of Apache common work mode, the difference?
Worker Mode: 1, thread mode 2, occupy less resources 3, stability slightly worse 4, concurrency large
Prefork mode: 1, process mode 2, occupy more than 3 of resources, stability 4, concurrency general
Apache by default is prefork, compile time general select worker Mode. If the worker mode is not specified at compile time, then the default prefork mode
The worker pattern has been determined, how is it tuned?
[email protected] blog]# cd/application/apache/conf/
[email protected] conf]# Vim httpd.conf
Remove # # # # # # # of conf/extra/httpd-mpm.conf lines
[email protected] conf]# CD extra/
[email protected] extra]# Vim httpd-mpm.conf
Inside the Worker mode debugging optimization Defaults to: #为注释
<ifmodule mpm_worker_module>
Startservers 2
MaxClients #将来调并发连接数就调这个地方
Minsparethreads 25
Maxsparethreads 75
Threadsperchild 25
Maxrequestsperchild 0
</IfModule>
If the concurrency number is adjusted from 150 to 1500, then the self-test will be prompted as Follows:
[email protected] extra]#. /.. /bin/apachectl-t
Warning:maxclients of would require servers,
and would exceed the Serverlimit value of 16.
Automatically lowering maxclients to 400. To increase,
Please see the Serverlimit Directive.
Syntax OK
If Serverlimit 1500 is added, Save the configuration file as shown below.
<ifmodule mpm_worker_module>
Serverlimit 1500
Startservers 2
MaxClients 1500
Minsparethreads 25
Maxsparethreads 75
Threadsperchild 25
Maxrequestsperchild 0
</IfModule>
Checking the grammar again will not be an Error.
[email protected] extra]#. /.. /bin/apachectl-t
Syntax OK
Then smooth and graceful restart.
[email protected] extra]#. /.. /bin/apachectl Graceful
At the interview, the difference between the two modes is Possible. Know how to debug concurrency
0549-apache Directory License function description and practice
Apache still has a lot of pits.
[email protected] extra]# pwd
/application/apache/conf/extra
[email protected] extra]# Vim httpd-vhosts.conf
Example where the path inside the DocumentRoot is the Specified/application/apache2.2.34/htdocs
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/application/apache2.2.34/htdocs/blog"
ServerName blog.etiantian.org
Errorlog "logs/blog-error_log"
Customlog "logs/blog-access_log" Common
</VirtualHost>
If the site is not under the specified path, then the configured site will error 403 Errors.
The reasons Are:
[email protected] extra]# CD.
[[email protected] conf]# ls
Extra httpd.conf Httpd.conf.bak Magic mime.types Original
[email protected] conf]# pwd
/application/apache/conf
[email protected] conf]# egrep-v "^$|#" httpd.conf
The path to the site has been specified by default in Httpd.conf. The default is as Follows:
<directory "/application/apache2.2.34/htdocs" >
Options-indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
If the site path is not the same as the default, simply add a label for the site path inside the Httpd.conf.
For example, Add the following Label: site Path/data/www is just an example.
<directory "/data/www" >
Options-indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
</Directory>
This article is from the "sandshell" blog, make sure to keep this source http://sandshell.blog.51cto.com/9055959/1960987
Introduction and configuration optimization of two kinds of working modes in 0548-apache