How to replace Apache with LiteSpeed when used with Plesk

With LSWS 3.3.1 Enterprise or later, the LSWS installer can setup configuration for Plesk automatically. The default LSWS configuration comes with support for both PHP4 and PHP5, however, only pre-built PHP4 binary is available, if you want PHP5 support, you need to install LSPHP through RPMs from LiteSpeed repository (for RHEL/CentOS Systems) or build PHP5 binary yourself. You should use the same PHP configuration used for building Apache mod_php to build the lsphp binary. You can user phpinfo page for Apache as a reference to install or build your own one.

The latest version of Plesk may configure Nginx as a reverse proxy server that stands in between the Internet and Apache. Before installing LSWS, please turn off Nginx reverse proxy so that Apache is the only web server handling live traffic. Not stopping the Nginx reverse proxy will cause system errors and block the LiteSpeed process from being started.

Please refer here on how to turn off nginx reverse proxy.

  • Install LiteSpeed Web Server as root user -- just run ./install.sh at command line. During installation, when you see
Will you use LiteSpeed Web Server with a hosting control panel?
  0. NONE
  1. cPanel
  2. DirectAdmin
  3. Plesk
  4. Hsphere
  5. Interworx
  6. Lxadmin
  7. ISPManager
Please select (0-7) [0]? 

For CentOS, just input 3 to select Plesk and select default. SuEXEC setting(yes or no) should be matched to exiting Apache setting.

For Debian, you should select NONE and update configurations manually via web console later. Also, you may need to set user/group to “www-data/www-data” when installer prompt for “User” and “Group” for Debian based installation.

Port Offset [2000]?

to run litespeed on port 2080 and apache on 80 at the same time.

  • LiteSpeed has default Admin Console Port as 7080 from long time ago, however Plesk use this port lately for reverse proxy bank-end Apache port, which causes numerous trouble and errors. We suggest to set default Admin Console Port to 7088 for Plesk users to avoid hassles.
  • Open LiteSpeed Web administration console, under “server”→“General” tab, view configurations in “Using Apache Configuration File” table. For Debian based installation, you need to manually set those configurations
Load Apache Configuration => Yes
Auto Reload On Changes    => User Apache binary Wrapper
Apache Binary Path        => /usr/sbin/httpd  (or /usr/sbin/httpd.worker if worker MPM is used)
Apache Configuration File => /etc/httpd/conf/httpd.conf
Apache Port Offset  => 2000      (Try LiteSpeed on port 2080 and 2443 first, change to 0 later)
Apache IP Offset    => 0             
PHP suEXEC          => Yes       (Run PHP in suEXEC mode)
PHP suEXEC Max Conn => 5         (The maximum PHP processor each account can have)

if previously all your PHP scripts run as “apache” user, then change above “PHP suEXEC” as “No”, and restart LSWS.

For Debian based installation, you may need to set “Apache Environment” according to /etc/apache2/envvars

  • Now LSWS host web sites on port 2080 and secured sites on 2443. You can test your domains for those two ports. Some application can not be tested this way. For example, WordPress specifies front-end URL with port in WP admin page hence you have no way to test 2080 unless you change it. If this case, you may have to just switch the traffic to LiteSpeed for testing.If all sites work properly, stop Apache, change “Apache Port Offset” to 0, restart LSWS, all hosted web sites are powered by LiteSpeed now.
  • in case you may fail to stop Apache(service httpd stop;service httpd status) after LSWS installed: check if /usr/sbin/httpd_ls_bak exists and /usr/sbin/httpd is just an lsws wrapper. then
/usr/sbin/httpd uninstall
service httpd stop
service httpd status

above “service httpd status” is to ensure apache stopped. then restart LSWS, to have it running on port 80 or 2080.

  • you may need to change rc script configuration to remove httpd from the services that get started automatically during a reboot. Try this from a root shell:
cd /etc/init.d
chkconfig httpd off
  • If you have a script that monitors for the web server process, remember to update it to reflect the location of LSWS. If your datacenter or third-party administrator monitors your web server for you, you may want to contact them to inform them of the change.

NOTE: If Apache worker MPM is used instead of the default prefork MPM, Plesk may complain about restarting Apache, if it happens, you have two choices to fix it.

  • to change Apache configuration back to prefork MPM, open /etc/sysconfig/httpd, comment out the line starting with “HTTPD=…”.
  • login to LSWS console, update “Apache Binary Path” from /usr/sbin/httpd to /usr/sbin/httpd.worker.

When LiteSpeed Standard Edition is used together with hosting control, when using Apache httpd.conf, it only can import top five <VirtualHost …> configuration sections based on the order in httpd.conf. So, if your web site shows the control panel welcome page, it means the limit has been hit, you should upgrade to our Enterprise Edition.

  • Admin
  • Last modified: 2016/02/09 16:47
  • by Michael Alegre