kumiskiri

Install Openlitespeed Centos

Jun 16th, 2023 (edited)
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.41 KB | Source Code | 0 0
  1. rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
  2.  
  3. yum install epel-release
  4.  
  5. yum install openlitespeed
  6.  
  7. yum install lsphp74 lsphp74-json lsphp74-xmlrpc lsphp74-xml lsphp74-tidy lsphp74-soap lsphp74-snmp lsphp74-pspell lsphp74-process lsphp74-pgsql lsphp74-pear lsphp74-pdo lsphp74-opcache lsphp74-odbc lsphp74-mysqlnd lsphp74-mcrypt lsphp74-mbstring lsphp74-ldap lsphp74-intl lsphp74-imap lsphp74-gmp lsphp74-gd lsphp74-enchant lsphp74-dba lsphp74-common lsphp74-bcmath lsphp74-memcached lsphp74-redis
  8.  
  9. #for CentOS 7
  10.  
  11. wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash
  12.  
  13. apt install openlitespeed
  14.  
  15. apt install lsphp74 lsphp74-common lsphp74-curl lsphp74-dev lsphp74-imap lsphp74-intl lsphp74-json lsphp74-ldap lsphp74-mysql lsphp74-opcache lsphp74-pspell lsphp74-memcached lsphp74-redis lsphp74-sqlite3 lsphp74-tidy
  16.  
  17. #for Ubuntu
  18.  
  19.  
  20. groupadd group-name
  21.  
  22. useradd -M -g group-name user-name
  23.  
  24. mkdir /home/domain.com
  25.  
  26. mkdir /home/domain.com/public_html
  27.  
  28. chown user-name:group-name /home/domain.com
  29.  
  30. chmod 711 /home/domain.com
  31.  
  32. chown user-name:nobody /home/domain.com/public_html
  33.  
  34. chmod 750 /home/domain.com/public_html
  35.  
  36. touch /home/domain.com/public_html/.htaccess
  37. chown -R user-name:group-name /home/domain.com/public_html/.htaccess
  38.  
  39. #create .htaccess for later use, this is optional
  40.  
  41. echo "<?php phpinfo();" > /home/domain.com/public_html/info.php
  42.  
  43. #create a phpinfo page to test
  44.  
  45. echo "hello world" > /home/domain.com/public_html/index.html
  46.  
  47. #create a static HTML page to test
  48.  
  49. chown -R user-name:group-name /home/domain.com/public_html/*
  50.  
  51. # replace "user-name", "group-name" and "domain.com" to your actual value
  52. # user-name and group-name can use any name you wish , but suggest to use domain name for easier management.
  53.  
  54.  
  55. # it is VERY important that you run that chown -R command to correctly set ownership for files after you migrate/upload files via SFTP or any other method.
  56. # it is VERY important that you run that chown -R command to correctly set ownership for files after you migrate/upload files via SFTP or any other method.
  57. # it is VERY important that you run that chown -R command to correctly set ownership for files after you migrate/upload files via SFTP or any other method.
  58. # if ownership is not correctly set , you may encounter permission denied error.
  59.  
  60.  
  61. systemctl start lsws
  62.  
  63. #start up OpenLiteSpeed
  64.  
  65. /usr/local/lsws/admin/misc/admpass.sh
  66.  
  67. # to set/reset the webadmin console login info.
  68.  
  69. https://your_server_ip:7080
  70.  
  71. # login to webadmin console , if you can not access it , make sure your firewall is NOT blocking it.
  72. # you can run "curl -I -XGET -k https://server_public_ip:7080" and "curl -I -XGET -k https://127.0.0.1:7080" to verify.
  73. # if 127 IP gives 301/302 response and public IP doesn't , that means 7080 port is not opened.
  74.  
  75. Address: uds://tmp/lshttpd/domain.sock
  76.  
  77. Max Connections: 10
  78. Environment: PHP_LSAPI_CHILDREN=10
  79. # this means maximum 10 PHP processes ,  change it to a high number GRADUALLY if your site requires lots PHP processes to process.
  80.  
  81. Command: /usr/local/lsws/lsphp74/bin/lsphp
  82.  
  83. Run As User: user-name
  84.  
  85. Run As Group: group-name
  86. #this will force PHP script to run as site user , for security concern.
  87.  
  88. # external app settings
  89.  
  90.  
  91. curl https://get.acme.sh | sh
  92.  
  93. # install acme.sh for let's encrypt certificate.
  94.  
  95. domain="domain.com" ; /root/.acme.sh/acme.sh --issue -d "$domain" -d www."$domain" -w /home/"$domain"/public_html
  96.  
  97. # replace "doamin.com" at first part of line to your actual domain  , and remove  -d www."$domain"    part if you don't use www domain.
  98.  
  99. # this is optional , you can use other tools like certbot , or just upload your own cert/key somehwhere and set path in webadmin console.
  100.  
  101. RewriteEngine On
  102. #RewriteCond %{HTTP_HOST} !domain\.com [NC,OR]
  103. RewriteCond %{HTTPS}  !=on
  104. RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
  105.  
  106. # rewriterule to force HTTPS, add it into previously created .htaccess file
  107. # change %{SERVER_NAME} to domain.com and remove # in second line, if you want to redirection http(s)://SERVER_IP to https://domain.com
  108.  
  109. # it is VERY important that you restart OpenLiteSpeed to load new .htaccess rules , otherwise it will not work.
  110. # it is VERY important that you restart OpenLiteSpeed to load new .htaccess rules , otherwise it will not work.
  111. # it is VERY important that you restart OpenLiteSpeed to load new .htaccess rules , otherwise it will not work.
Advertisement
Add Comment
Please, Sign In to add comment