User resources and configuration of web-servers

From ISPWiki
Jump to: navigation, search

Introduction

Specifying user resources configures a web-server according to the values selected. This article describes resources that can affect configuration of a web-servers.

Nginx configuration

"Simultaneous connections per session", which sets the maximum number of simultaneous connection from a certain IP address to be processed by Nginx, can modify Nginx configuration. Changing this limit will perform the following operations:

1. In the ispresources.conf file of the Nginx configuration file (it is specified as path nginx-conf.d in the panel's configuration file), distributed memory zone configuration is created with the key $binary_remote_addr. It is named by the user name.

limit_conn_zone $binary_remote_addr zone={ username }:{ 8 * OS bit version * "Simultaneous connections per session" value }k;

For example, the following distributed memory zone will be created for user1, if "Simultaneous connections" are set to 10:

limit_conn_zone $binary_remote_addr zone=user1:640k;

2. In the web-domain's configuration (it is specified as path nginx-vhosts-resources in the panel's configuration file) a new directory is created. It is named by the user name and contains the file connlimit.conf, which sets the maximum number of connections for the memory zone key described above:

limit_conn { zone name = username } { "Simultaneous connections per session" };

For example, the following record will be created for user1, for which "Simultaneous connections per session" are described above:

limit_conn user1 10;

The file will be included into configuration of all Nginx virtual servers that belong to the user this limit is set for.

PHP-FPM configuration

The "User processes" resource, which limits the number of processes a user can run, can modify PHP-FPM configuration.

This limit will change the pm.max_children parameters in PHP-FPM custom pool configuration:

pm.max_children = { "User processes" }

E.g., if "User processes" are set to 7 for user1, the following record will be added into the pool configuration:

pm.max_children = 7

The default value is 5. It ill be applied, if "User processes" are set to "unlimited".

Apache configuration

Resources that influence configuration of every www-domain

  • "Apache handlers" - limits the maximum number of Apache handlers that process the user's WWW-domain
  • "CPU time" - limits CPU usage by user processes.
  • "RAM" - limits the maximum amount of RAM that a user can consume.
  • "User processes" - limits the maximum number of user processes that a user can run.

The above processes may affect the vhost.conf file that is created in the directory named by the user name. The directory is located in the Apache configuration file (it is specified as path apache-vhosts-resources in the control panel configuration file). This file is included into configuration of every VirtualHost of a certain user. If any of the resources described is defined, it will be specified in the file:

  • MaxClientsVHost { "Apache handlers" value }
  • RLimitCPU { "CPU time" value }
  • RLimitMEM { "RAM" value * 1024 * 1024 }
  • RLimitNPROC { "User processes" value }

Resources that influence "PHP as Apache" configuration

The following resources can influence a www-domain that runs "PHP as Apache":

  • "CPU time" - limits CPU usage by user processes.
  • "RAM" - limits the maximum amount of RAM that a user can consume.

The above processes may affect the php5_module.conf file that is created in the directory named by the user name. The directory is located in the Apache configuration file (it is specified as path apache-vhosts-resources in the control panel configuration file). This file is included into configuration of every VirtualHost, which runs PHP as Apache. If any of the resources described is defined, it will be specified in the file:

  • php_admin_value memory_limit { "RAM" value }
  • php_admin_value max_execution_time { "CPU time" value * coefficient }

The Coefficient is defined by the MaxExecutionTimeRatio (the default value is 1) parameter value when calculating max_execution_time. PHP maximum execution time is not associated with CPU limit, so you can choose an optimal coefficient for the MaxExecutionTimeRatio parameter, or set it to 0 if this calculation method does not meet your hosting automation needs. If the coefficient is set to 0, max_execution_time won't be specified in the Apache configuration file.