DocumentRoot must be a directory,关闭SElinux,apache之MPM参数;

...

看到报错:DocumentRoot must be a directory,请查看SELinux的状态

# getenforce

Enforcing

请关闭SELinux

# setenforce 0

# getenforce

Permissive

# vim /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#       enforcing - SELinux security policy is enforced.

#       permissive - SELinux prints warnings instead of enforcing.

#       disabled - SELinux is fully disabled.

#SELINUX=enforcing

SELINUX=disabled

#reboot

# getenforce

Disabled

==============================

http://blog.csdn.net/chinalinuxzend/article/details/2813827

原贴:http://www.diybl.com/course/6_system/linux/Linuxjs/2008629/129166.html

关闭SELinux的方法:
修改/etc/selinux/config文件中的SELINUX="" 为 disabled ,然后重启。
如果不想重启系统,使用命令setenforce 0
注:
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式 
在lilo或者grub的启动参数中增加:selinux=0,也可以关闭selinux 

#---------------------------------------------------------------
查看selinux状态:
/usr/bin/setstatus -v 
如下:
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   permissive
Mode from config file:          enforcing
Policy version:                 21
Policy from config file:        targeted 
  
getenforce/setenforce查看和设置SELinux的当前工作模式

 

http://hi.baidu.com/vilifone/item/1f34460be5bc8031a2332a4a

Apache配置之MPM---

<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    ServerLimit         450
    MaxClients          450
    MaxRequestsPerChild   0
</IfModule>

 

/etc/httpd/conf/extra/httpd-mpm.conf

 

 

WARNING: MaxClients of 2500 exceeds ServerLimit value of 256 servers, 
lowering MaxClients to 256. To increase, please see the ServerLimit 
directive. 

apache2更改最大连接数是不需要重新编译的吧? 
我的apache版本2.0.58,工作模式prefork。最近一段时间,apache总是突然莫名其妙的就死掉,查看日志,发现 

[Tue Aug 19 10:21:30 2008] [error]server reached MaxClients setting, consider raising the MaxClients setting 
[Tue Aug 19 10:21:30 2008] [error] could not make child process 1455 exit, attempting to continue anyway 
[Tue Aug 19 10:21:30 2008] [error] could not make child process 1456 exit, attempting to continue anyway 
[Tue Aug 19 10:21:30 2008] [error] could not make child process 1457 exit, attempting to continue anyway 
[Tue Aug 19 10:21:30 2008] [error] could not make child process 1458 exit, attempting 

应该是最大连接数不够了,于是我将 

# 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 
<IfModule prefork.c> 
StartServers 10 
MinSpareServers 10 
MaxSpareServers 15 
MaxClients 2500 
ServerLimit 3000 
MaxRequestsPerChild 10000 
</IfModule> 

更改为如上模样。 

重启apache后,出现个警告: 
WARNING: MaxClients of 2500 exceeds ServerLimit value of 256 servers, 
lowering MaxClients to 256. To increase, please see the ServerLimit 
directive. 

这个为什么会产生这个警告啊,让我将MaxClients降为256? 

谢谢

 

找到原因了。 

prefork模式下 

<IfModule prefork.c> 
ServerLimit 3000 
StartServers 10 
MinSpareServers 10 
MaxSpareServers 15 
MaxClients 2500 
MaxRequestsPerChild 10000 
</IfModule> 

ServerLimit这个参数放在这几个参数的最上面,否则无效,还会产生一个警告。放在最上面就没事了 
似乎worker模式下也要这么放。

 

http://topic.csdn.net/u/20080819/11/6e2c4a34-7f34-4ca2-a8e7-2e78418227c1.html

 
如:
ServerLimit 1024 
MaxClients 1000

你应该好好理解一下ServerLimit就像一个木桶,用他来装MaxClients这个水,所以ServerLimit一定要大于MaxClients
而且ServerLimit需要放在MaxClients上面,更确切的说ServerLimit允许的最大总进程数阀值

 

posted @ 2012-07-12 10:28  陳聽溪  阅读(354)  评论(0)    收藏  举报