有没有办法在不查看配置文件的情况下找出实时系统上的 MaxClients 值

有没有办法在不查看配置文件的情况下找出实时系统上的 MaxClients 值

现在我们正在设置一个 Debian 服务器,使用 Apache2 作为 Web 服务器。由于不同的配置文件可能会对设置产生影响,因此我想在命令行或 Web 浏览器上输出实时配置文件值,尤其是 MaxClients。

我设置了 mod_info 和 server-status,希望能够在那里看到值,但是我似乎无法在那里找到正确的值。

有人能帮助我吗?

答案1

MaxClients是服务器范围的关键字,因此每个httpd进程应该有一个实例(通常每个 Linux 服务器一个实例)。假设典型的 Debian 安装,您只需 grep 值即可:

 grep -r -e MaxClients -e anothervalue -e anothervalue2 /etc/apache2/ | grep -v \#

答案2

您可以使用模块查找信息mod_info

在我的服务器上我得到了这个

Module Name: prefork.c
Content handlers: none
Configuration Phase Participation: none
Request Phase Participation: none
Module Directives:
User - Effective user id for this server
Group - Effective group id for this server
ChrootDir - The directory to chroot(2) into
ListenBacklog - Maximum length of the queue of pending connections, as used by listen(2)
Listen - A port number or a numeric IP address and a port number, and an optional protocol
SendBufferSize - Send buffer size in bytes
ReceiveBufferSize - Receive buffer size in bytes
StartServers - Number of child processes launched at server startup
MinSpareServers - Minimum number of idle children, to handle request spikes
MaxSpareServers - Maximum number of idle children
MaxClients - Maximum number of children alive at the same time
ServerLimit - Maximum value of MaxClients for this run of Apache
GracefulShutdownTimeout - Maximum time in seconds to wait for child processes to complete transactions during shutdown
Current Configuration:
In file: /etc/apache2/apache2.conf
 133: StartServers 5
 134: MinSpareServers 5
 135: MaxSpareServers 10
 136: MaxClients 150
 178: User www-data
 179: Group www-data
In file: /etc/apache2/ports.conf
   9: Listen 80
  17: Listen 443

相关内容