Litespeed - configuration
Well, we've installed Litespeed with the latest PHP release, secured the admin area connection and upgraded to the latest version.
Now we can configure Litespeed to server our PHP sites and our Ruby on Rails Applications.
First thing is to log into the Admin area:
https://123.45.67.890:31000
On the welcome screen, click on 'Server Config'
Once there you will see several tabs such as General, Log, Tuning and so on. Most don't need any changes from the default settings but take the time to have a look at all of them and get an idea of how to administer the server. It isn't difficult and having it all laid out in this manner saves a lot of time. As a server admin, any time saving is greatly appreciated.
On the General tab, the only thing you might want to change are the Index Files as the default is to serve index.html files only. However, if I want to serve a PHP based site, I will add index.php at the Virtual Host level and not server wide.
This is one of the things that can take a bit of getting used to in that everything can be uniquely adjusted for each and every virtual host - I don't want to search for index.php files on every site I host so I don't set it at a server wide level.
Moving on, I suggest leaving the Logging defaults as they are - I set logging at the virtual host level so each site I serve has its own, separate log folders and files.
Tuning Tab: Let's change a few things in the Connection box:
Click on the 'edit' link. Have a look at the info 'bubble' next to Max Connections - it gives information regarding the setting and states that the hard limit for the standard edition of Litespeed is 150. While this is true, you would need a very busy site to exceed this amount. As it is hard coded, I leave it at the default 2000 configuration.
Change Smart Keep Alive from 'No' to 'Yes' - again, the info 'bubble' gives some very good information.
As my server is Ubuntu (and assuming you've followed the tutorials, yours is as well) I will change the I/O Event Dispatcher to 'epoll'. FreeBSD and Solaris have different choices here. Set whatever best fits your server.
That's it from the Tuning Tab, click 'save' and move on to the Security Tab.
I leave things as they are here because, as usual, I like to specify any site peculiarities at the virtual host level. For server wide settings, the default is good for me. Note at the bottom, there is an Access Control box - use this to ban spamming IPs at a server wide level.
Guess what? You can also do this on a per-domain level. Useful indeed.
The Request Filter Tab is the equivalent of Apache's mod_security and can assist in preventing SQL injection and XSS attacks.
We already had a quick look at the External App Tab when setting up PHP 5.2.1 on our server but have another look. From my experience the defaults are perfectly fine for a PHP based site.
The Script Handler Tab contains, well, script handlers. You can add more types, depending on your site. The php entry was automatically created when we set up PHP.
On to the Ruby Rails Tab:
This was the main reason I migrated to Litespeed: no messing about with load balancers or mongrel clusters or pounds and, more importantly, no wasting time. You'll see later on that setting up and serving a Ruby on Rails Development or Production site takes seconds from virtual host creation to serving the application.
Anyway, depending on how the size of your VPS you could change the Max Connections value. A common mistake here is to set it at a high level. On a 512MB Slice setting the value to 10 would be a good value - on a load test, that can handle around 350 requests per second with no problem at all.
It should be noted that on a smaller VPS, say 128MB, the Max Connections should be set at 2, or 3 at the most (although 128MB is too small to run a Rails App effectively anyway).
I also change the Environment Idle variable from 60 to 300 so it reads:
LSAPI_MAX_REQS=1000
LSAPI_MAX_IDLE=300
Run On Start Up is already set at 'Yes'. This will reduce the initial page creation of our Rails application. Also, just below that, set the Max Idle Time variable to -1. Again, this will decrease initial page creation.
Click 'save' and 'Apply Changes' and Gracefully Restart the server. Once restarted, have a look at the Server Log Viewer to see if anything has gone awry.
Obviously, the settings I recommended here will not suit all needs but it is a good start for PHP based sites and for Ruby on Rails sites and applications.
The next article outlines the Virtual Host Layout used throughout these articles. This makes for easier understanding of the settings when we customise our PHP and Ruby on Rails vhosts.
PickledOnion.
Digg it |
del.icio.us |
reddit |
StumbleUpon

Subscribe to Feed