Wiki
 

How to replace Apache with LiteSpeed when used with DirectAdmin

With LSWS 3.3.1 Enterprise or later, the LSWS installer can setup configuration for DirectAdmin 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 build PHP5 binary yourself. Just login to the web console then select “Actions”→“Build PHP“. You should use the same PHP configuration used for building Apache mod_php to build the lsphp binary, you can get the information from a phpinfo() page.

Steps to replace Apache with LSWS

  • Install LiteSpeed Web Server as root user. During installation, set User/Group to “apache:apache”, do NOT import Apache configuration, do NOT set 80 and 2080 as the HTTP service port, those ports will be used when httpd.conf is loaded.
  • Open LiteSpeed Web administration console, under “server”→“General” tab, change configurations in “Using Apache Configuration File” table.
Load Apache Configuration => Yes
Auto Reload On Changes    => Yes (Changes made in DirectAdmin will be applied automatically)
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)
  • The owner of /var/log/httpd/domains need to be changed from root:nobody to apache:nobody.

chown apache:nobody /var/log/httpd/domains

  • [NOT REQUIRED ANY MORE] If WebMail is used, WebMails configuration need to be changed to store temporary files under each user's home directory.

1. in file /var/www/html/webmail/inc/config.php changes $temporary_directory… to:

$uidinfo = posix_getpwuid(posix_getuid()); 
$temporary_directory = (($uidinfo['name']=='apache')?'tmp/':"/home/".$uidinfo['name']."/webmail/uebimiau/");

2. in file /var/www/html/squirrelmail/config/config.php shoud insert after line

$data_dir = SM_PATH . 'data/'; 

these lines:

$uidinfo = posix_getpwuid(posix_getuid()); 
if($uidinfo['name']!='apache') { 
  @mkdir("/home/".$uidinfo['name']."/webmail");
  @mkdir("/home/".$uidinfo['name']."/webmail/squirrelmail"); 
  $data_dir = "/home/".$uidinfo['name']."/webmail/squirrelmail/"; 
}
  • 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. To have DA stop monitoring Apache process, do
  1. Open /usr/local/directadmin/data/admin/services.status in any editor
  2. Set HTTPD to “OFF” (instead of ON)
  3. Restart the DirectAdmin service

Note: 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 for LiteSpeed Standard Edition

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.

 
litespeed_wiki/apache/da.txt · Last modified: 2008/12/15 12:25 (external edit)