How to convert standalone Apache to LiteSpeed

This may works with LiteSpeed Standard Edition depends on how many virtual hosts configured in Apache. You can try Enterprise Edition with a trial license to find out how many vhosts imported from Apache.

Note: for support issues, please use LiteSpeed forum for free support or order Hourly support for fast turnaround.

Step 1: Install LiteSpeed Speed Web Server

  1. Download LSWS tarball from LiteSpeed Tech website .
  2. Unpack the tarball and run install script. For Enterprise Edition, make sure put license (trial or paid license file in the unpacked folder)
  3. Choose default for all the options
    • LiteSpeed target install directory (/usr/local/lsws)
    • Listen Port ( 8088 )
    • Assign user name and password for LWSW 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: 2012/12/14 21:09 (external edit)