Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:apache:migration [2015/07/08 14:31]
Jackson Zhang [Step 4: Start LiteSpeed again]
— (current)
Line 1: Line 1:
-====== How to Convert Standalone Apache to LiteSpeed ====== 
  
-This wiki covers how to set up LSWS (either Enterprise or Standard [[litespeed_wiki:​license:​what_license_to_choose|editions]]) on a server that already has a working Apache installation but no control panel. 
- 
- 
-===== Step 1: Install LiteSpeed Speed Web Server ===== 
- 
-==== 1.1 Download ==== 
- 
-Download LSWS tarball from the [[http://​www.litespeedtech.com/​download/​litespeed-web-server-download|LiteSpeed Technologies website]]. 
- 
-Run the following commands from ssh as root 
- 
-  cd /root 
-  wget http://​www.litespeedtech.com/​packages/​4.0/​lsws-4.2.12-ent-x86_64-linux.tar.gz 
- 
-**Note:** Replace the values in the URL to control for your OS and which version/​[[litespeed_wiki:​license:​what_license_to_choose|edition]] of LSWS you wish to download: 
- 
-''​lsws-4.2.12-ent-x86_64-linux''​ = LSWS Enterprise 4.2.12 for 64bit Linux 
- 
-''​lsws-4.2.10-std-i386-linux''​ = LSWS Standard 4.2.10 for 32bit Linux 
- 
-''​lsws-4.2.12-ent-x86_64-freebsd6''​ = LSWS Enterprise 4.2.12 for 64bit FreeBSD 6.x 
- 
-==== 1.2 Unpack ==== 
- 
-  tar zxfv  lsws-4.2.12-ent-x86_64-linux.tar.gz 
- 
-==== 1.3 Run the installation script ==== 
- 
-For Enterprise Edition, make sure to put the license file (trial.key or paid license serial.no file in the unpacked folder). 
- 
-  cd lsws-4.2.12 
-  ./​install.sh 
- 
-The installer will ask you a number of questions (covered in detail [[http://​www.litespeedtech.com/​docs/​webserver/​install|here]]). Choose the default setting when in doubt, but you have to set the same username and groupname as Apache for LiteSpeed process to run as (choosing LiteSpeed default setting nobody:​nobody may create file permission problem): 
-    * LiteSpeed target install directory (/​usr/​local/​lsws). 
-    * Assign the same username and group as Apache for LSWS to run as (You need to check with Apache configuration or Apache running process. It maybe nobody:​nobody,​ apache:​apache or www-data:​www-data etc.) 
-    * Listen port (8088)(8088 is for sample testing site only. LSWS will automatically check Apache configuration for Listening port if "Load Apache Configure"​ selected as instructed below). 
-    * Default Web Admin Port:7080 
-    * Assign a username and password for LSWS web admin console. 
-    * Your email address as the Administrators email. 
-===== Step 2: Install PHP ===== 
- 
-Two options for setting up PHP for LiteSpeed: 
- 
-  - Enable the LiteSpeed repository and download LSPHP from our repository. See [[litespeed_wiki:​php:​rpm#​installing_php_from_the_litespeed_repository|instructions]] here.You may have default php.ini file installed through RPMs and You just need to make some changes to match it to exiting Apache PHP. Check both phpinfo pages for difference. ​ 
-  - If you are not using CentOS or you need PHP packages that are not included in our repository, you can build your own PHP [[litespeed_wiki:​php:​lsapi#​compiling_php_through_wedadmin_console|from LiteSpeed Web Admin Console]] or [[/​litespeed_wiki:​php:​lsapi#​compiling_php_from_source_code|from PHP source code]]. See [[litespeed_wiki:​apache:​migration:​buildphp|more PHP compiling options and instructions]] here. You may need to create your own php.ini file for your compiled binary. It can be copied from your exiting Apache PHP configuration or from PHP source code package php.ini-production file. For example for Debain Apache2, you may run: 
-    
-<​code>​cp /​etc/​php5/​apache2/​php.ini /​usr/​local/​lsws/​lsphp5/​lib/​php.ini </​code>​ 
- 
-Of course, Apache php.ini location or LSPHP installation prefix may be different. You can easily change it accordingly. ​ 
-===== Step 3: Load Apache Configuration in LSWS ===== 
-Open LiteSpeed Web admin console, under "​server"​→"​General"​ tab, change configurations in "Using Apache Configuration File" table. 
-<​code>​ 
-Load Apache Configuration => Yes 
-Auto Reload On Changes => Use Apache Binary Wrapper ​ 
-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, do NOT use 8088 or 8008) 
-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) 
-</​code>​ 
- 
-**Note:​** ​ 
-  * "PHP suEXEC Max Conn" can be adjusted based how many and how big the sites has been hosted. For a server dedicated for a large Wordpress or vBulletin site, you can safely increase it to "​10",​ "​15"​ or "​20",​ try different value and see what is the best for you. 
-  * Different system/​platform,​ default Apache Configuration File is different. For example, for CentOS, it is located at /​etc/​httpd/​conf/​httpd.conf;​ for WHM/cPanel, it is /​usr/​local/​apache/​conf/​httpd.conf;​ for Debian Apache2, it is /​etc/​apache2/​apache2.conf. ​ 
- 
-Sometimes your Apache conf file may have environment parameters set in /​etc/​apache2/​envvars or other locations, such as: 
-  User ${APACHE_RUN_USER} 
-  Group ${APACHE_RUN_GROUP} 
-  ... 
-You have to include it in "​Apache Environment"​ within "Using Apache Configuration File" table in the Web Admin Console.For example: ​ 
-  APACHE_RUN_USER=www-data 
-  APACHE_RUN_GROUP=www-data 
-  APACHE_PID_FILE=/​var/​run/​apache2.pid 
-  APACHE_RUN_DIR=/​var/​run/​apache2 
-  ​ 
-If LiteSpeed runs into some absolute path problem such as 
-  [/​etc/​apache2/​apache2.conf:​250] Failed to get absolute path for [/​usr/​local/​apache/​ports.conf]! 
-  2015-07-06 12:​37:​03.282 ERROR [/​etc/​apache2/​apache2.conf:​267] Failed to get absolute path for     ​[/​usr/​local/​apache/​conf.d/​]! 
-  2015-07-06 12:​37:​03.282 ERROR [/​etc/​apache2/​apache2.conf:​270] Failed to get absolute path for   ​[/​usr/​local/​apache/​sites-enabled/​]! 
-  2015-07-06 12:​37:​03.582 ERROR HttpListener::​start():​ Can't listen at address 127.0.0.1:​80:​ Address already in use! 
-  2015-07-06 12:​37:​03.582 ERROR HttpServer::​addListener(127.0.0.1:​80) failed to create new listener 
-  2015-07-06 12:​37:​03.882 ERROR HttpListener::​start():​ Can't listen at address 63.247.170.35:​80:​ Address already in use! 
-  2015-07-06 12:​37:​03.883 ERROR HttpServer::​addListener(63.247.170.35:​80) failed to create new listener 
-  2015-07-06 12:​37:​03.883 ERROR [:5] Listener for default is not available! 
-  2015-07-06 12:​37:​16.601 ERROR [ADMIN] authentication failed! 
-  2015-07-06 12:​38:​12.156 ERROR [ADMIN] authentication failed! 
- 
-which simply means your apache2 configuration may have some relative path problem. You may just set server root in apache2 configuration to clear all above absolute path errors. 
- 
-  ServerRoot "/​etc/​apache2"​ 
-  ​ 
-Most of the time, LSWS loads your Apache configuration straight away without any error. 
-===== Step 4: Start LiteSpeed again ===== 
- 
-Restart LSWS and try web sites hosted on port 2080 and secured sites on 2443. If there is any problem, most likely a PHP issue, you need to check LSWS error log, LSWS stderr log or PHP error log for details. Server error log and stderr log are set to the following location by default unless you customize it.  
-  /​usr/​local/​lsws/​logs/​error.log 
-  /​usr/​local/​lsws/​logs/​stderr.log 
-  ​ 
-For PHP error logs, they are normally located at the directory where PHP script runs: 
- 
-You may go to your server document root and find them: 
-  find . -name php_errors.log 
- 
-You should check the php_errors.log for corresponding locaiton where the PHP script running into problems. Try to clear the error, which may fix the problem. Sometime even undefined date.timezone in php.ini may cause problems. ​ 
- 
-If all sites work properly, stop Apache, change "​Apache Port Offset"​ to 0, restart LSWS, all hosted web sites are powered by LiteSpeed now. 
- 
-**Note:** Remember to change rc script configuration to remove httpd from the services that get started automatically during a reboot. For example, On CentOS, try this from a root shell: 
- 
-   ​chkconfig httpd off 
- 
-You may also want to add lsws to be started automatically during a reboot: 
- 
-   ​chkconfig lsws on 
- 
-On Debian, try the following: 
-  update-rc.d -f apache2 ​ remove 
-  update-rc.d lsws defaults 
-===== Step 5: Monitor ===== 
-  
-If you have a script that monitors for the web server process, remember to update it to reflect the location of LSWS. 
- 
-That's it. 
  • Admin
  • Last modified: 2015/07/08 14:31
  • by Jackson Zhang