Posted by Fred Wu
This is a How-to guide for users who want to install and experiment LiteSpeed on LxAdmin Host-In-A-Box, with or without Apache.
All my current shared hosting accounts are using cPanel, I wasn’t a big fan of it because it was (and still is) bloated and buggy. cPanel 11 did improve a little bit so I now at least don’t *hate* to use it. I’ve been playing with different web control panels for a few years now. Did I mention I once even co-owned a web hosting company? :) I personally prefer the simplicity of DirectAdmin, and the nice interface-feature balance of Interworx-CP. Although they are very good control panels, they aren’t free. Web developers (such as myself) and programmers often need VPS or even dedicated servers to perform live testing and debugging. A free control panel seems to be a nice and affordable addition to this process. :) I had been searching for one for years. Believe it or not, all free control panels sucked at that time. They either had the feature or had the interface, but never had both. Until recently (and that was about a year ago) I had discovered LxAdmin, it is in my opinion the best overall free/cheap control panel to date. I got the free 300-domain license a while ago, I’m not sure if it’s still available but even if it’s not, it is dirt cheap. Feature wise it is much more powerful than DirectAdmin, and interface wise it is pretty similar to Plesk (which by the way I don’t really like, but still better than other free ones such as ServerCP).
I discovered LiteSpeed a few years ago and had played with it for a bit. At that time the free version still has a concurrent connection limit of 300. Anyway, the experience was pretty good. It is a shame though that the price tag for the enterprise version is a little extreme for personal use. If I had a high profile website or a company website then I would definitely consider using LiteSpeed. It has a very useful web GUI that controls all the configuration. No messing around with shell commands and files any more!
Okay that was a little background story, now let’s begin incorporating the two together.
If you have a VPS and your host provides LxAdmin, then most likely you have access to HyperVM. You can install / rebuild LxAdmin Host-In-A-Box within that control panel. If you don’t have HyperVM, don’t worry, just head over to LxLabs for the installation guide. Installation is very simple by the way.
After you have installed LxAdmin. Login, and click on the ‘Server’ tag at the top. Look for ‘Switch Program’, click on it, then at the next screen, select Apache as the web server (by default LxAdmin uses Lighttpd). This step is necessary because LiteSpeed is compatible with Apache, so we will tell LiteSpeed to use some of Apache’s configuration files later on.
Now you can SSH to your server (if you don’t know how to do this, ask Google!), download LiteSpeed and install it! Caution: Do not disable Apache yet, install LiteSpeed to whatever port other than 80 (which is being used by Apache for now), make sure to use the same user/group as Apache (apache/apache by default) and do NOT import Apache configuration!
Let’s now login to LiteSpeed’s GUI, and make necessary changes according to this guide:
- Install LiteSpeed Web Server in a root shell, make sure to let it run as the same user/group that Apache run as. During installation, do NOT import Apache configuration, do NOT set 80 or 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 WHM/cPanel will be applied automatically) 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) 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)
- Restart LSWS and try web sites hosted on port 2080 and secured sites on port 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.
So you restarted LSWS and saw the default Apache page, but you soon realised that the virtual hosts don’t work in LSWS! Don’t panic, we will fix that.
We will need to change one file, the Apache configuration file:
Copy the second last line (‘Include /etc/httpd/conf/lxadmin/virtualhost.conf‘) and paste it to the second line which is under ‘Include /etc/httpd/conf/lxadmin/mimetype.conf‘. Done! Save and close the file now.
Restart LiteSpeed… boom! Your virtual hosts should now be working!
Refer to the guide earlier, you can now either shut down Apache, or ask Apache to run on a different port and let LiteSpeed to handle the requests from port 80. Be aware that port 79 is a restricted port, you won’t be able to access this port via web browsers other than Internet Explorer.
It is pretty much all done as far as web serving goes. There is one more thing we need to do: fix the log files.
Go back to your LiteSpeed GUI. Click on ‘Web Console’ -> ‘General’.
Edit the file names of ‘Virtual Host Log’ and ‘Access Log’. Make them to read as below:
Virtual Host Log => $VH_ROOT/stats/$VH_ROOT-error_log Access Log => $VH_ROOT/stats/$VH_ROOT-custom_log
Cool, restart LiteSpeed and everything is done!
You will see some warnings and errors in your server log but they can be ignored.
Hopefully this guide is useful to you. I have posted some benchmark tests if you’re interested! :)