分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 网页技术

Apache优化深入

发布时间:2023-09-06 02:12责任编辑:顾先生关键词:暂无标签
**压力测试 ???[root@CentOS7-1 ~]# which ab
/usr/bin/ab

ab -n2000 -c800 www.benet.com/index.html

//发送2000请求,并发连接800

可以关闭压缩功能,观察测压结果
**
Apache工作模式 ?

event模式(默认) ?查看工作模式 ?cd /usr/local/httpd/bin ???
./httpd -l ?????
yum install lsof -y

**lsof -i :80

COMMAND ?PID ??USER ??FD ??TYPE DEVICE SIZE/OFF NODE NAME
httpd ??2266 ??root ???3u ?IPv4 ?15838 ?????0t0 ?TCP 192.168.100.101:http (LISTEN)
httpd ??2267 daemon ???3u ?IPv4 ?15838 ?????0t0 ?TCP 192.168.100.101:http (LISTEN)
httpd ??2268 daemon ???3u ?IPv4 ?15838 ?????0t0 ?TCP 192.168.100.101:http (LISTEN)
httpd ??2269 daemon ???3u ?IPv4 ?15838 ?????0t0 ?TCP 192.168.100.101:http (LISTEN)

一个root主进程带有多个daemon子进程**

prefork模式 ???
./configure \
--prefix=/usr/local/httpd \
--enable-deflate \
--with-mpm=prefork \
--enable-expires \
--enable-so \
--enable-rewrite \
--enable-charset-lite \
--enable-cgi

**vim /etc/httpd.conf
Include conf/extra/httpd-mpm.conf

vim /usr/local/httpd/conf/extra/httpd-mpm.conf
<IfModule mpm_prefork_module>
StartServers ????????????10 ??????# 启动时进程数
MinSpareServers ?????????10 ??????# 最小空闲进程数
MaxSpareServers ????????50 ???????# 最大空闲进程数
MaxRequestWorkers ?????150 ???????#最大并发进程数
MaxConnectionsPerChild ??0 ???????# 最大连接数限制
</IfModule>**

worker模式 ????
./configure \
--prefix=/usr/local/httpd \
--enable-deflate \
--with-mpm=worker \
--enable-expires \
--enable-so \
--enable-rewrite \
--enable-charset-lite \
--enable-cgi
?

**vim /etc/httpd.conf
Include conf/extra/httpd-mpm.conf

<IfModule mpm_worker_module>
StartServers ????????????2 ?????#启动时进程数
MinSpareThreads ????????25 ?????#最小空闲线程数
MaxSpareThreads ????????75 ?????#最大空闲线程数
ThreadsPerChild ????????25 ?????#每个进程可以启动的线程数量
MaxRequestWorkers ?????150 ?????#线程数量最大值
MaxConnectionsPerChild ??0 ?????#最大连接数限制
ThreadLimit ????????????64 ?????#每个进程可以启动的线程数量上限值
</IfModule>
**

**目录属性 ???
vim /etc/httpd.conf

<Directory "/usr/local/httpd/htdocs">
Options Indexes FollowSymLinks

AllowOverride None<RequireAll> ????Require all granted ?????//允许所有 ????Require not ip 192.168.176.140 ??//不让176.140访问</RequireAll>

</Directory>**

Apache优化深入

原文地址:http://blog.51cto.com/13706698/2165573

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved