LiteSpeed Web Server has a lot of settings. It’s true. We know. These settings are helpful to tweak and fine tune your server. But sometimes, when you’re just getting started with a new environment, feature, or application, all those settings can be overwhelming. That is why we are introducing custom virtual host templates. These templates give you virtual hosts ready to perform different functions or use with different applications. You can still customize and tune different parts of the setup if you want, but these templates will give you a workable LSWS for your particular function in just a few quick and easy steps.
(These templates work for any edition of LiteSpeed, whether it’s Enterprise, Standard, or OpenLiteSpeed. We’ve placed the template files and tutorials on the OpenLiteSpeed site, though, because we feel they’re of the most use to OpenLiteSpeed users.)
The first template we’ve introduced is for WP Super Cache, a simple and powerful caching plugin for WordPress. The steps for setting up a WordPress site on LiteSpeed with WP Super Cache using the WP Super Cache template are listed below. Now, a lot of you are going to look at that and say, “That’s not quick or easy. Your tutorial has 18 steps!” You’re right. It does have 18 steps. But most of those steps are installing WordPress and WP Super Cache. I timed myself. One install on a clean CentOS 6.4 VM took 25:51.2 with less than five minutes for the LiteSpeed configurations (perhaps 10 minutes was spent building PHP for WordPress). And anyone who has talked to me at length knows that I’m not a tech guy. Try it. If you’ve installed WordPress before, you’ll be surprised how few steps LSWS adds.
Setting Up LiteSpeed Web Server and WP Super Cache:
Templates are an easy way to set up OpenLiteSpeed for various uses. In the following article we will guide you through the steps to set up virtual hosts running WP Super Cache, a powerful caching plugin that should increase the ability of the your WordPress site to handle gobs of visitors. The first part of this article will cover importing the template. After the template is imported, you just need to create virtual hosts for each domain you want to run with WP Super Cache, and install WordPress and WP Super Cache in those virtual hosts.
Note: Any setting not specifically noted in this walkthrough can be left as the default.
Import the WP Super Cache template
1. Download the template file.
2. Save the template file to /usr/local/lsws/conf/templates/wpsupercache.xml.
3. Make sure user lsadm has write permission.
chown lsadm /usr/local/lsws/conf/templates/wpsupercache.xml
4. Add the template on the WebAdmin console.
- WebAdmin console > Configuration > Virtual Host Templates > Add
Template Name: wpsupercache (name it anything as long as it does not conflict with existing templates) Template File: $SERVER_ROOT/conf/templates/wpsupercache.xml Mapped Listeners: Default
Note: In order for the server to direct traffic to the proper vhost, you must have listeners set up to listen on the proper IP and port. When you use a virtual host template, you do not have to define listener-to-virtual host mappings in the listener settings. Instead you set the mapped listeners when adding a template. In the above settings, we have used the listener “Default”, which is set up to listen on port 8088 of “ANY” IP by default. You must adjust your listener settings to make sure there are listeners on the IP and ports you need. (The easiest way to do this is for most sites to just change the port setting to “80″ for the Default listener in WebAdmin console > Configuration > Listeners > Default > General. This gives you a listener listening on port 80 of all IPs.)
5. Graceful restart to apply changes. (Actions > Graceful Restart)
Set up virtual hosts using this template
1. Create a member virtual host from the template.
- WebAdmin console > Configuration > Virtual Host Templates > wpsupercache > Member Virtual Hosts > Add
Virtual Host Name: super1 Domain: domain.example.com
- Note: We have named our WP Super Cache vhost “super1″. You can name it whatever you want, but remember to then replace any instances of “super1″ in this tutorial with the name of your virtual host.
2. Create directories for this vhost.
- As the root user, run the following commands:
chown lsadm:lsadm /usr/local/lsws/super1/conf
3. Graceful restart to apply changes. (Actions > Graceful Restart)
- Your new vhost is now live and ready for WordPress and WP Super Cache. All you have to do is install them.
1. RPM install.
yum install mysql mysql-devel mysql-server libxml2-devel gd-devel gcc gcc-c++ make patch
2. Build PHP.
- Build PHP (5.3.24, for example) with additional modules.
- Go to the WebAdmin Console > Actions > Compile PHP
'--with-mysqli' '--with-zlib' '--with-gd' '--enable-shmop' '--enable-track-vars' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-magic-quotes' '--enable-mbstring' '--with-iconv' '--with-mysql' '--with-libdir=lib64'
Note: ‘–with-libdir=lib64′ is for x86_64 systems.
6. Graceful restart to apply changes. (Actions > Graceful Restart)
3. Download WordPress into your virtual host document root: /usr/local/lsws/super1/html
4. Grant the web server user write permission for WordPress WP Super Cache installation.
chown -R nobody wordpress
5. Set up a MySQL database and user for WordPress.
- Instructions can be found at http://codex.wordpress.org/Installing_WordPress#Detailed_Instructions
6. Graceful restart to apply changes. (Actions > Graceful Restart)
7. Point your browser to http://server_ip:8088/wordpress/wp-admin/install.php to run the WordPress installer.
Install and configure WP Super Cache
1. In the WordPress dashboard, go to Plugins > Add New. Search for WP Super Cache and install it.
2. Once WP Super Cache is installed, go to the plugin admin page (Settings > WP Super Cache), and configure it as follows:
Easy Caching: Caching On Advanced Caching: Cache hits to this website for quick access Use mod_rewrite to serve cache files. Compress pages so they're served more quickly to visitors. Don't cache pages for known users. Don’t cache pages with GET parameters. (?x=y at the end of a url) Make known users anonymous so they’re served supercached static files. Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated.
3. If a page is served from supercache it will have a signature at the end of response page similar to the one below: (This signature is only visible when viewing the source.)
<!-- Dynamic page generated in 1.187 seconds. --> <!-- Cached page generated by WP-Super-Cache on 2013-05-31 00:02:57 --> <!-- Compression = gzip -->