internetearnings.com

Install RRDtool Graph to Monitor LiteSpeed Server in cPanel/WHM

For cPanel/WHM user, Munin is great server monitoring tools. It functions as a data logging and graphing system for time-series data. It can save years of real-time stats for data server and dispaly them in RRDtool graph at any time.

However, if you are using LiteSpeed Webserver, some of the data that related to Apache Webserver such as concurrent http connection will become unavailable.

Fortunately, LiteSpeed to provide an alternative monitoring tool but independent of Munin.

Below are the guides on how to install them.

Let assume the following

a. LiteSpeed install at – usr/local/lsws/fcgi-bin/lsphp5

b. cPanel username – cpuser

c. Main domain for cpuserwebsite.com

Make sure you are using your information for all 3 information above.

Below is the step by step guides on how to install it RRDtool Graph for LiteSpeed.

1. SSH as a root user to your server & issue the following command

cd /usr/local/lsws/add-ons/rrdgraph
./rrdgraph_install.sh

 

2. Key in ‘y‘ indicate you have install RRDtool. Normally, RRDtool installed together with cPanel.

 

3. When asked about destination – Destination [/usr/local/lsws/DEFAULT/html]: key-in /home/cpuser/public_html

 

4. When asked about lsphp5 location – lsphp5 location: [/usr/local/lsws/fcgi-bin/lsphp5], if the LiteSpeed installation is correct, press enter or else type in the correct location

 

5. When installation complete, edit config file by issuing the following command

nano /home/cpuser/public_html/ls_stats/config/main.php

 

6. Scroll down until you see

'rrdtool' => '/usr/bin/rrdtool',

 

7. Change it to

'rrdtool' => '/usr/local/cpanel/3rdparty/bin/rrdtool',

 

8. Change user permission setting by typing

chown -R cpuser:cpuser /home/cpuser/public_html/ls_stats

 

9. Login to cpuser cPanel account.

 

10. Click on Cron-job icon.

 

11. In Common Settings:, select Every minute ( * * * * *).

 

12. In Command: area type in

/usr/local/lsws/fcgi-bin/lsphp5 /home/cpuser/public_html/ls_stats/update.php >/dev/null

 

13. Installation completed. You can access the monitoring tools at

http://website.com/ls_stats/

 

14. Alternative, you may want to set-up subdomain such as litespeed.website.com & point this sub-domain to /home/cpuser/public_html/ls_stats


Redirect Default CakePHP Pagination URL to SEO Friendly URL with .htaccess

In the previous post, I post a guide on how to create SEO friendly URL in CakePHP pagination.

However, if you already use default CakePHP pagination prior to that, you want to redirect the old pagination URL to the new SEO friendly URL.

I’m using .htaccess file to accomplish this.

Let’s take an example, by default we will have pagination URL like this

http://www.website.com/post
http://www.website.com/post/page:2
http://www.website.com/post/page:3
...

we would like to redirect to

http://www.website.com/post
http://www.website.com/post/page/2
http://www.website.com/post/page/3
...

To redirect, we have to edit .htaccess file located at /app/webroot/.htaccess. Next, add the following code.

RewriteEngine On
RewriteBase /
RewriteRule ^(.+)/page:([0-9]+)/$ /$1/page/$2/ [R=301,L]