Apache2 + PHP 在Windows2000下不稳定解决方案
来源:互联网 发布:云南java招聘 编辑:程序博客网 时间:2024/04/27 12:21
1 制作一个bat文件在计划任务里面定期(每天夜里)执行:然后删除旧的日志文件,避免文件过大
apache -k shutdown
move /Y access_log access_log.old
move /Y error_log error_log.old
apache -k start
2 [httpd.conf]
<IfModule mpm_winnt.c>
ThreadsPerChild 250
MaxRequestsPerChild 30 <- 这个可以为100,但最好不要为0
Win32DisableAcceptEx <-这个
</IfModule>
3 使用更详细日志捕捉死机时访问的页面
LogFormat "%h %l %u %t /"%r/" %>s %b /"%{Referer}i/" /"%{User-Agent}i/"" combined
记录refer可以帮助确认发生问题的请求来自什么页面,以判断是否受到攻击
可以使用"%400,501{User-agent}i" "%!200,304,302{Referer}i" 来捕捉特定需要的log
4 在计算机管理->性能中,启动性能日志和警报->计数器日志->System Overview。根据一段时间的监测的数据,在系统监视器里面查看,找到发生死机的异常时候,内存,CPU的极值的规律。然后在警报里面,如果超过,或接近某个极值,执行重起apache命令。
5 无论如何在你的程序里面加上缓存机制:无论是通过生成静态html页面或者设置meta expired为几分钟
6 在php.ini里面,将output_buffering=On 不要设置具体的数值
7 对于文件下载,使用以下的方法,而不要使用readfile
//readfile($file);
$fd = @fopen($file, rb);
if(!$fd) {
print "Bad entry: $entry<br>";
continue;
}else {
flock($fd,LOCK_SH);
$contents = fread($fd, $size);
}
fclose ($fd);
8 为了防止多线程下载,给Apache 加上mod_limitipconn
<IfModule mod_limitipconn.c>
<Location /mp3>
MaxConnPerIP 1
# In this case, all MIME types other than audio/mpeg and video*
# are exempt from the limit check
OnlyIPLimit audio/mpeg video
</Location>
</IfModule>
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Apache2 + PHP 在Windows2000下不稳定解决方案
- 两篇关于论文格式等问题的文章
- 中国房地产将在三年内崩溃!(zt)
- 升级到MySQL 5.0.17一定遇到的四个问题
- Enabling Secure Sockets Layer for SharePoint Portal Server 2003
- 你绝对未见过的珍贵历史照片!强烈推荐!
- Apache2 + PHP 在Windows2000下不稳定解决方案
- Remoting的一些文章索引,方便阅读 (狂好的,值得收藏的好文啊)
- 面向智能体编程(Agent Oriented Programmig, AOP)一些体会(zt)
- 白话面向智能体编程(Agent Oriented Programmig, AOP)之二 (zt强文)
- 怎样看待微软的 Program Manager 这个角色(转载)
- 白话面向智能体编程(Agent Oriented Programmig, AOP)之一(zt强文)
- 白话面向智能体编程(Agent Oriented Programmig, AOP)之三
- 电梯里的恶作剧(新奇笑)
- 看李开复最新的书《做最好的自己》(Be Your Personal Best)