Documentation

mod_hostinglimits -- LVE limits for apache

[0.8/cPanel Production]

Description:Wraps around PHP/CGI scripts, making them to run within LVE context
Status:External
Module Identifier:hostinglimits_module
Source Files:mod_hostinglimits.c
Compatibility:Unix pre-fork/worker/event MPM

Summary 

mod_hostinglimits works with existing cgi/php modules, to put them into LVE context. In most cases the cgi/php process will be placed into LVE with ID of user that sites belongs to. mod_hostinglimits detects the user from SuexecUserGroup (suexec module), AssignUserID (MPM ITK), RUidGid (mod_ruid2) directives.

This can be overwritten via LVEId or LVEUser parameter on the Directory level. The order of detection is like following:

  • LVEId
  • LVEUser
  • SuexecUserGroup
  • RUidGid
  • AssignUserID

  1. LVE doesn't work for mod_include #include due to its "filter" nature.
Example:
LoadModule hostinglimits_module modules/mod_hostinglimits.so
<IfModule mod_hostinglimits.c>
   AllowedHandlers cgi-script php5-script php4-script

</IfModule>

SuexecUserGroup 

User and group for processes spawned by daemon. This parameter is used by mod_hostinglimits to figure out user id under which sites run, and use it as LVE ID for that site. In most cases nothing has to be done beyond setting this directive. Most modern control panels will set this parameter by default.

SkipErrors 

Description:Allow apache to continue if LVE is not available
Syntax:SkipErrors On
Default:SkipErrors On
Context:server config
Status:External
Module:mod_hostinglimits

Prevents apache from existing if LVE is not available.

Example:
SkipErrors Off


AllowedHandlers Directive 

Description:List of handlers that should be placed into LVE, support regexp
Syntax:AllowedHandlers cgi-script %^php%  my-script
Default:none
Context:server config
Status:External
Module:mod_hostinglimits

This directive allows to list handlers which will be intercepted and placed into LVE.

Example:
Match requests handled by cgi-script handler
AllowedHandlers cgi-script 
Match all requests 
AllowedHandlers *
Match all requests that handled by handler that contains php 
AllowedHandlers %php%
Match all requests handled by handler that starts with php 
AllowedHandlers %^php%
DenyHandlers Directive 
Description:List of handlers that should not be placed into LVE, support regexp
Syntax:AllowedHandlers text/html
Default:none
Context:server config
Status:External
Module:mod_hostinglimits

This directive works together with AllowHandlers, to exclude some handlers from being allowed in LVE
Example: 

Match all requests, but text/*   
AllowedHandlers *
DenyHandler %text/*%


LVEErrorCode 

Description:Error code to display once entry is rejected due to maxEntryProcs
Syntax:values from 500 to 510
Default:508
Context:directory config
Status:External
Module:mod_hostinglimits

Specifies ErrorCode to use on LVE error (like too many concurrent processes running). The message that will be displayed by default is:

Resource Limit Is Reached
The website is temporarily unable to server your request as it exceeded resource limit.
Please try again later.

You can redefine error message using ErrorDocument directive
Example: 
LVEErrorCode 508
ErrorDocument 508 508.html


LVEId 

Description:Allows to setup separate LVE id on per directory level. If not set, user id of corresponding user is used
Syntax:LVEId number
Default:User Id is used
Context:directory config
Status:External
Module:mod_hostinglimits

Specifies LVE id for particular directory

Example:
<Directory "/home/user1/domain.com/forums">
  LVEId 10001
</Directory>

LVEUser

Description:Allows to setup separate LVE id on per directory level. 
Syntax:LVEUser username
Default:none
Context:directory config
Status:External
Module:mod_hostinglimits

Specifies LVE id for particular directory

Example: 
<Directory "/home/user1/domain.com/forums">
  LVEUser user1
</Directory> 


LVERetryAfter

Description:Returns Retry-After header when LVE error 508 occurs. 
Syntax:LERetryAfter MINUTES
Default:240 minutes
Context:directory config
Status:External
Module:mod_hostinglimits

Specifies interval for Retry-After header.  The Retry-After response-header field can be used w to indicate how long the service is expected to be unavailable to the requesting client.

Example: 
LVERetryAfter 180

LVEParseMode

Description:Determines the way LVE id will be extraced. In Conf
Syntax:LVEParseMode CONF|PATH|OWNER
Default:CONF
Context:directory config
Status:External
Module:mod_hostinglimits

In CONF mode, standard way to extract LVE id is used (SuexecUserGroup, LVEId, or similar directives.

In PATH mode, username is extracted from the home directory path. The default way to match username is via following regexp  /home/([^/]*)/. Custom regexp can be specified in LVEPathRegexp

In OWNER mode, owner of the file used as a LVE id

Example:  
LVEParseMode CONF

LVEPathRegexp

Description:Regexp used to extract username from the path. Used in conjuction with LVEParseMode PATH
Syntax:LVEPathRegexp regexp
Default:/home/([^/]*)/
Context:directory config
Status:External
Module:mod_hostinglimits

Used to extract user's name via path.

Example:  
LVEPathRegexp /home/([^/]*)/