krlaboratories

OpenLiteSpeed Starter Guide by Cr0n

Jan 26th, 2022 (edited)
899
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.60 KB | None | 0 0
  1. /* installation OLS on Ubuntu 20.04 server */
  2.  
  3. **update OS**
  4. sudo apt-get update
  5. sudo apt-get upgrade
  6.  
  7. **disable SElinux (optional)**
  8. apt install policycoreutils
  9. sudo sestatus
  10. nano /etc/selinux/config
  11. put SELINUX=disabled
  12. reboot
  13.  
  14. **install OLS web server and PHP**
  15.  
  16. sudo wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash
  17. apt-get install openlitespeed
  18. apt-get install lsphp74 lsphp74-common lsphp74-curl lsphp74-imagick lsphp74-memcached lsphp74-imap lsphp74-json lsphp74-intl lsphp74-mysql lsphp74-opcache lsphp74-opcache lsphp74-redis
  19. ln -sf /usr/local/lsws/lsphp74/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
  20. systemctl status openlitespeed
  21. netstat -plntu
  22. netstat -pl | grep lsphp
  23.  
  24. **install MariaDB SQL database and configuration**
  25.  
  26. sudo apt install mariadb-client mariadb-server
  27. systemctl start mariadb
  28. systemctl enable mariadb
  29. Systemctl status mariadb
  30.  
  31. mysql_secure_installation
  32. Set a root password? [Y/n] Y
  33. Remove anonymous users? [Y/n] Y
  34. Disallow root login remotely? [Y/n] Y
  35. Remove test database and access to it? [Y/n] Y
  36. Reload privilege tables now? [Y/n] Y
  37.  
  38. mysql -u root -p
  39. select User, Password, Host from mysql.user;
  40.  
  41. mysql -u root mysql
  42. SET PASSWORD FOR root@localhost=PASSWORD('new_password');
  43. FLUSH PRIVILEGES;
  44.  
  45. **setup access to WebAdmin Console**
  46.  
  47. cd /usr/local/lsws/admin/misc/
  48. sh admpass.sh - put auth credentials for WebAdmin panel
  49. open URL and login:
  50. http://IP_address:7080/
  51.  
  52. **install CSF firewall and open ports for OLS(optional)**
  53. wget http://download.configserver.com/csf.tgz
  54. tar -xvzf csf.tgz
  55. cd csf
  56. bash install.sh
  57. perl /usr/local/csf/bin/csftest.pl
  58.  
  59. nano /etc/csf/csf.conf
  60. add ports 7080 and 8088 to firewall rules
  61. csf -r
  62.  
  63. **set PHP 7.4 for LiteSpeed**
  64.  
  65. http://[IP_address]:7080/
  66. follow 'Server Configuration' -> 'External App' -> click "+" (Add)
  67. choose 'LiteSpeed SAPI App' -> click the 'Next'
  68. fill configuration:
  69. Name: lsphp74
  70. Address: uds://tmp/lshttpd/lsphp.sock
  71. Notes: lsphp74 for OpenLiteSpeed
  72. Max Connections: 35
  73. Initial Request Timeout (secs): 60
  74. Retry Timeout (secs): 0
  75. Command: $SERVER_ROOT/lsphp74/bin/lsphp
  76. Save
  77.  
  78. follow 'Server Configuration' -> 'Script Handler' -> click edit
  79. change handler name to 'lsphp74'
  80. Save
  81. Graceful restart
  82. check php version:
  83. http://IP_address:8088/phpinfo.php
  84.  
  85. **set ports 80 and 443**
  86.  
  87. follow 'Listeners' -> Default -> view
  88. edit 'Address Settings'
  89. change port 8088 to 80 (optional)
  90. Save
  91. graceful restart
  92.  
  93. follow 'Listeners' -> Add (+)
  94. Listener name: HTTPS
  95. IP Address: ANY
  96. Port: 443
  97. Secure: Yes
  98. Save
  99. graceful restart
  100.  
  101. **add new virtual host (domain website)**
  102.  
  103. cd /usr/local/lsws
  104. mkdir domain.com
  105. cd domain.com
  106. mkdir {public_html,logs}
  107.  
  108. follow 'Virtual Hosts' -> Add (+)
  109. Virtual Host Name: domain.com
  110. Virtual Host Root: $SERVER_ROOT/domain.com
  111. Config File: $SERVER_ROOT/conf/vhosts/domain.com/vhconf.conf
  112. Enable Scripts/ExtApps: Yes
  113. Restrained: Yes
  114. Save
  115. Click to create vhost.conf
  116.  
  117. follow 'Virtual Host' -> View -> 'General' -> Edit
  118. Document Root: $VH_ROOT/public_html
  119. Save
  120.  
  121. follow 'Listeners' -> Default -> Edit default 'Example.com' Virtual host mappings and change domain
  122. Save
  123. follow 'Listeners' -> HTTPS -> Edit and add new Virtual host mappings domain
  124. Save
  125.  
  126. follow 'Virtual Host' -> Domain -> Rewrite and edit
  127. enable 'Rewrite' and 'Auto load from .htaccess'
  128.  
  129. Graceful restart
  130.  
  131. check URL:
  132. http://domain.com
  133.  
  134. **install Memcached**
  135.  
  136. apt-get install memcached
  137. systemctl start memcached
  138. systemctl enable memcached
  139.  
  140. Now you can install WordPress in public_html or copy files.
  141.  
  142.  
  143. ***PHP.INI EDIT ***
  144.  
  145. nano /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini
  146. nano /usr/local/lsws/lsphp74/etc/php/7.3/litespeed/php.ini
  147.  
  148.  
  149. **** COMMANDS ****
  150.  
  151. systemctl start lsws
  152. systemctl stop lsws
  153. systemctl restart lsws
  154. cat /usr/local/lsws/bin/openlitespeed -t //errors
  155.  
  156.  
  157. References:
  158. https://openlitespeed.org/kb/step-by-step-install-ols/
  159. https://openlitespeed.org/kb/ssl-setup/
  160. https://openlitespeed.org/kb/wordpress/
  161. https://openlitespeed.org/kb/how-to-setup-lscache-for-wordpress/
  162. https://www.howtoforge.com/tutorial/how-to-install-and-configure-openlitespeed-with-php-7-4-on-ubuntu-1804/
  163. https://www.howtoforge.com/tutorial/how-to-install-openlitespeed-with-php-on-centos-8/
  164. https://tungdt.net/install-openlitespeed-mariadb-php8-0-on-ubuntu-20-04-18-04-server/
  165. https://kamrul.dev/deploy-wordpress-with-openlitespeed-on-docker-swarm/
  166. https://developers.cloudflare.com/fundamentals/get-started/network-ports
  167. https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-openlitespeed-ubuntu-1804
  168. https://build-in-saratov.com/openlitespeed-aws/
Advertisement
Add Comment
Please, Sign In to add comment