apache 相关的配置
1.apache 在 linux 的工作模式有哪些:有什么特点,怎么使 apache 使用 worker 模式?
apache 在 Linux 中的工作模式有三种:目前我了解俩种,一种是 prefork 模式,另一种是
worker 模式
prefork 的特点:多进程、较慢、cpu 占用率高、稳定、对 bug 自我排错、小流量网站使用。
worker 的特点:多线程、较快、cpu 占用率低、较不稳定、无法自我排错、大流量网站使
用。
使用 worker 模式:(1)先把原有的 apache 服务关闭
(2)进入解压包的时候、安装目录
(3)清除 make 的缓存 make clean
(4)从新预配置,在原有的基础上在添加--with-mpm=worker
配 置 prefork 的 工 作 模 式 : 先 启 用 主 配 置 文 件 httpd-mpm.conf , 在 修 改 vim
/usr/local/httpd/conf/extra/httpd-mpm.conf
<IfModule mpm_prefork_module>
Serverlimit 1000
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 300
MaxRequestsPerChild 10000
</IfModule>
配置 worker 的工作模式:
<IfModule mpm_prefork_module>
Serverlimit 40
ThreadLimit 200
StartServers 4
MaxClients 1000
MinSpareThreads 25
MaxSpareThreads 10
MaxRequestsPerChild 1000
</IfModule>
2.怎么调整 apache 的长连接时间保持?
(1)修改 apache 的主配置文件 ,启用 Include conf/extra/httpd-default.conf
(2)在修改 httpd-default.conf 文件