Command unknown: diff134436417

How to Convert Standalone Apache to LiteSpeed

This wiki covers how to set up LSWS (either Enterprise or Standard editions) on a server that already has a working Apache installation but no control panel.

Step 1: Install LiteSpeed Speed Web Server

1.1 Download

Download LSWS tarball from the LiteSpeed Technologies website.

Run the following commands from ssh as root

cd /root

Note: Replace the values in the URL to control for your OS and which version/edition of LSWS you wish to download:

lsws-4.2.12-ent-x86_64-linux = LSWS Enterprise 4.2.12 for 64bit Linux

lsws-4.2.10-std-i386-linux = LSWS Standard 4.2.10 for 32bit Linux

lsws-4.2.12-ent-x86_64-freebsd6 = LSWS Enterprise 4.2.12 for 64bit FreeBSD 6.x

1.2 Unpack

tar zxf  lsws-4.2.12-ent-x86_64-linux.tar.gz

1.3 Run the installation script

For Enterprise Edition, make sure to put the license file (trial.key or paid license file in the unpacked folder).

cd lsws-4.2.12

The installer will ask you a number of questions (covered in detail here). When in doubt, choose the default for all questions:

  • LiteSpeed target install directory (/usr/local/lsws).
  • Listen port (8088).
  • Assign a username and password for LSWS web admin console.
  • Your email address as the Administrators email.

Step 2: Build matching PHP binary

There is a pre-built PHP 4 binary coming with LSWS, however, you should build your own PHP binary using matching configuration options used by Apache mod_php.

  1. Get a list of compile options (type 'php -i' and look for the line with 'Configure Command ⇒' as shown below:)
root@test ~># php -i
PHP Version => 5.3.10
Configure Command =>  './configure'  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' \
'--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' \
'--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' \
'--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' \
'--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' \
'--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' \
'--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' \
'--enable-gd-native-ttf' '--with-t1lib=/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' \
'--with-jpeg-dir=/usr' '--with-openssl' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' \
'--enable-magic-quotes' '--enable-sockets' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' \
'--enable-calendar' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--with-mhash' \
'--enable-force-cgi-redirect' '--libdir=/usr/lib64/php' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' \
'--enable-mbstring=shared' '--enable-mbregex' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' \
'--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--enable-mysqlnd=shared' \
'--with-mysql=shared,mysqlnd' '--with-mysqli=shared,mysqlnd' '--with-mysql-sock=/var/lib/mysql/mysql.sock' \
'--with-oci8=shared,instantclient,/usr/lib64/oracle/11.2/client64/lib,11.2' \
'--with-pdo-oci=shared,instantclient,/usr,11.2' '--with-interbase=shared,/usr/lib64/firebird' \
'--with-pdo-firebird=shared,/usr/lib64/firebird' '--enable-dom=shared' \
'--with-pgsql=shared' '--enable-wddx=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' \
'--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--with-curl=shared,/usr' \
'--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,mysqlnd' \
'--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pdo-dblib=shared,/usr' '--without-sqlite3' \
'--with-sqlite=shared,/usr' '--enable-json=shared' '--enable-zip=shared' '--without-readline' '--with-libedit' \
'--with-pspell=shared' '--enable-phar=shared' '--with-mcrypt=shared,/usr' '--with-tidy=shared,/usr' \
'--with-mssql=shared,/usr' '--enable-sysvmsg=shared' '--enable-sysvshm=shared' '--enable-sysvsem=shared' \
'--enable-posix=shared' '--with-unixODBC=shared,/usr' '--enable-fileinfo=shared' '--enable-intl=shared' \
'--with-icu-dir=/usr' '--with-enchant=shared,/usr' '--with-recode=shared,/usr'
  1. Compile PHP from LSWS Admin Console (Actions ⇒ Compile PHP) with mod_php compile options.

Note: './configure' needs to be removed when cut and paste to LSWS Admin Console. That is, just cut and paste the options above starting from “'–build=x86_64-redhat-linux-gnu' '–host=x86_64-redhat-linux-gnu' …” (remove “Configure Command ⇒ './configure' ”)

Step 3: Load Apache Configuration in LSWS

Open LiteSpeed Web admin console, under “server”→“General” tab, change configurations in “Using Apache Configuration File” table.

Load Apache Configuration => Yes
Auto Reload On Changes => Use Apache Binary Wrapper 
Apache Configuration File => /usr/local/apache/conf/httpd.conf
Apache Port Offset => 2000 (Try LiteSpeed on port 2080 and 2443 first, change to 0 later, do NOT use 8088 or 8008)
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)


  • “PHP suEXEC Max Conn” can be adjusted based how many and how big the sites has been hosted. For a server dedicated for a large Wordpress or vBulletin site, you can safely increase it to “10”, “15” or “20”, try different value and see what is the best for you.
  • Different system/platform, default Apache Configuration File is different. For example, for CentOS, it is located at /etc/httpd/conf/httpd.conf; for WHM/cPanel, it is /usr/local/apache/conf/httpd.conf.

Step 4: Start LiteSpeed again

Restart LSWS and try web sites hosted on port 2080 and secured sites on 2443. If all sites work properly, stop Apache, change “Apache Port Offset” to 0, restart LSWS, all hosted web sites are powered by LiteSpeed now.

Note: Remember to change rc script configuration to remove httpd from the services that get started automatically during a reboot. For example, On CentOS, try this from a root shell:

 chkconfig httpd off

Step 5: Monitor

If you have a script that monitors for the web server process, remember to update it to reflect the location of LSWS.

That's it.

litespeed_wiki/apache/migration.txt · Last modified: 2014/06/27 16:23 by Michael Armstrong