Tuesday, August 2, 2011

Lite speed configuration + PHP recompilation

Features of LiteSpeed WebServer

- Runs on almost all platforms like Linux, FreeBSD, Solaris, Mac OS X etc
- It is fully compatible with most of the common control panels like cPanel, Ensim, DirectAdmin, Plesk, etc.
- PHP scripting is up to 50% faster than Apache’s mod_php

1.Litespeed configuration

1.1 Check Litespeed

Take http://IP:7080/ on the browser, you will see a Litespeed welcome page.

Let us check if it is listening to the port we have mentioned.

# netstat -pant | grep lshttpd
tcp 0 192.168.1.19:7080 0.0.0.0:* LISTEN 18718/lshttpd
tcp 0 192.168.1.19:80 0.0.0.0:* LISTEN 18718/lshttpd

1.2 Admin Area

You can manage the admin area at

http://IP:7080/.

Here IP is your server IP

1.3 Log Files are resides under

log :: /usr/local/lsws/.

2. To Integrate with DA

LiteSpeed Web Server works very well with Directadmin managed web sites. The performance will increase up to 10x times by replacing apache with lsws.

To replace Apache with LSWS :-

2.1 Goto admin area

Access admin area at http://IP:7080 and with the admin username and password.

2.2 Goto Configurations >> Server >> General.

Keeping the cursor against the button along with each option will give you a small definition about the same.

2.3 Scroll down to “Using Apache Configuration File”

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 => 1000 (Try LiteSpeed on port 1080 and 1443 first, change to 0 later)
Apache IP Offset => 0
PHP suEXEC => Yes (Run PHP in suEXEC mode)
PHP suEXEC Max Conn => 8 (The maximum PHP processor each account can have)

2.4 Scroll back up to “Index Files” and set it as follows:

Index Files index.html, index.php, index.php5, index.php4, index.htm
Auto Index Not Set
Auto Index URI Not Set

2.5 Scroll down to “HT Access”

Allow Override Check: Limit, Auth, FileInfo, Indexes, Options Uncheck: None
Access File Name .htaccess

2.6 Goto Configurations >> Server >> Listeners

delete all current listeners.

2.7 Now restart the webserver

service lsws restart

33 PHP recompilation

By default, Litespeed comes with PHP 4.4.x compiled with LSAPI and hence we have to install latest stable version of PHP with LSAPI for our LiteSpeed. With PHP LiteSpeed SAPI, LiteSpeed’s PHP performance is much more efficient than Apache’s mod_php or fast_CGI.

You can easily recompile PHP in the server from the Panel.

3.1 login to admin area.

http://IP:7080/.

3.2 Go to

Admin >> Actions >> Recompile PHP

3.3 Recompile PHP

Compile PHP with LSAPI

3.3.1 Step 1 : Select a PHP version

Here you can select PHP version. Select your desired PHP version and click next.

3.3.2 Step 2 : Choose PHP 5.2.9 Build Options

Here I have selected PHP 5.2.9

a. Load Configuration

- Use configuration from previous Build
- Restore default

b. Install Path Prefix - You can specify installation path

c. Configure Parameters - Configuration command

d. Security Patches Suhosin (General Hardening) Mail Header (Identifies Mail Source)

e. Install Opcode Cache None APC eAccelerator XCache

3.2.4 Click Build PHP

3.4 Here you will get a custom phpbuild command.

If you log in as root, you can directly run the command:

# /usr/local/lsws/phpbuild/buildphp_manual_run.sh

If you log in as a user who has sudo permission, you can run the command with sudo and input root password after prompt.

$ sudo /usr/local/lsws/phpbuild/buildphp_manual_run.sh

To apply changes, please visit Control Panel and execute a Graceful Restart. Apply Changes

No comments:

Post a Comment