Getting started with CloudLinux OS Shared
Mod_lsapi to improve performance of PHP sites
Apache mod_lsapi is a module based on LiteSpeed Technologies API for PHP. It offers excellent PHP performance, low memory footprint coupled with great security and support for opcode caching.
Using LSAPI, we have seen higher performance than Apache with mod_php, easier installation than php-fpm and easier integration with any control panel. LSAPI means faster and more stable dynamic web pages.
- PHP Selector with alt-php – an easy way to select different PHP versions for each end-user provided by CloudLinux
- Disabled PHP-FPM, mod_ruid2 and apache_itk
- ea-php – alternative to alt-php (cPanel only)
Also recommended for higher security level:
- Configured LVE limits for end-users
- Apache with SuExecuUserGroup directive for each user’s VirtualHost
Mod_lsapi installation on cPanel with EasyApache 4:
Choose a predefined profile with mod_lsapi named with “+mod_lsapi” from WHM > Software > EasyApache 4.
Or, in console, Install packages, make initial setup and update cagefs:
yum install liblsapi liblsapi-devel
yum install ea-apache24-mod_lsapi
Enable mod_lsapi for all domains at once:
Then restart apache:
service httpd restart
Used configuration file: /etc/apache2/conf.d/lsapi.conf
Installation on other panels:
Follow the mod_lsapi documentation
The default settings are suitable for most web servers. Useful directives that you may want to change to tune up liblsapi:
lsapi_backend_children – maximum number of simultaneously running children backend processes. Default value is 80. Increase to speed up response time.
lsapi_backend_pgrp_max_idle – how long a control backend process will wait for a new request before it exits, in seconds. Default value is 30. Increase to make faster response; decrease to minimize memory usage.
lsapi_backend_max_process_time – the maximum processing time allowed when processing a request, in seconds. Should match max_execution_time in php.ini settings.
lsapi_backend_max_idle – how long a backend child process will wait for a new request before it exits, in seconds. Increase for better websites performance. Default is 300.
lsapi_backend_max_reqs – how many requests each child process will handle before it exits automatically. Default is 10000.