2010-05-05 16:25:07 +00:00
|
|
|
module Apache
|
|
|
|
module MPM
|
2010-05-07 20:04:06 +00:00
|
|
|
# Set up the Prefork MPM
|
|
|
|
#
|
2010-05-10 19:57:34 +00:00
|
|
|
# prefork_config do
|
|
|
|
# start 5
|
|
|
|
# spares 5, 20
|
|
|
|
# limit 100
|
|
|
|
# clients 100
|
|
|
|
# max_requests 1000
|
|
|
|
# end
|
|
|
|
#
|
|
|
|
# becomes:
|
|
|
|
#
|
|
|
|
# StartServers 5
|
|
|
|
# MinSpareServers 5
|
|
|
|
# MaxSpareServers 20
|
|
|
|
# ServerLimit 100
|
|
|
|
# MaxClients 100
|
|
|
|
# MaxRequestsPerChild 1000
|
|
|
|
#
|
2010-05-07 20:04:06 +00:00
|
|
|
def prefork_config(&block)
|
|
|
|
self + Apache::MPM::Prefork.build(&block)
|
|
|
|
end
|
|
|
|
|
2010-05-10 19:57:34 +00:00
|
|
|
# Builder for Prefork MPM
|
|
|
|
# See Apache::MPM::prefork_config for usage.
|
2010-05-05 16:25:07 +00:00
|
|
|
class Prefork
|
|
|
|
class << self
|
|
|
|
def build(&block)
|
|
|
|
@config = ['', '# Prefork config', '']
|
|
|
|
|
|
|
|
self.instance_eval(&block)
|
|
|
|
|
|
|
|
@config
|
|
|
|
end
|
|
|
|
|
|
|
|
def method_missing(method, *opts)
|
|
|
|
if which = {
|
|
|
|
:start => 'StartServers',
|
|
|
|
:spares => [ 'MinSpareServers', 'MaxSpareServers' ],
|
|
|
|
:limit => 'ServerLimit',
|
|
|
|
:clients => 'MaxClients',
|
|
|
|
:max_requests => 'MaxRequestsPerChild'
|
|
|
|
}[method]
|
|
|
|
case which
|
|
|
|
when String
|
|
|
|
@config << "#{which} #{opts * " "}"
|
|
|
|
when Array
|
2010-05-12 18:24:35 +00:00
|
|
|
which.each do |tag|
|
|
|
|
@config << "#{tag} #{opts.shift}"
|
2010-05-05 16:25:07 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|