├── Banner ├── classicpress ├── cyberjoomla ├── cyberpanel ├── django ├── drupal ├── joomla ├── litespeed ├── nodejs ├── ruby └── wordpress ├── Cloud-init ├── claunch.sh ├── launch.sh ├── lsws-instance.sh └── per-instance.sh ├── LICENSE ├── README.md ├── Setup ├── classicpsetup.sh ├── conf │ └── ols2ent │ │ ├── example.conf │ │ ├── httpd.conf │ │ └── httpd_config.xml ├── cyberjoomlasetup.sh ├── cybersetup.sh ├── djangosetup.sh ├── domainsetup.sh ├── drupalsetup.sh ├── joomlasetup.sh ├── nodejssetup.sh ├── ols2ent-v2.sh ├── ols2ent.sh ├── railssetup.sh ├── vhsetup.sh └── wpimgsetup.sh ├── Static ├── cp-landing.html ├── drupal-landing.html ├── joomla-landing.html └── wp-landing.html ├── _image ├── cyberpanel_50.svg ├── django_50.svg ├── drupal_50.svg ├── joomla_50.svg ├── lsws_50.svg ├── nodejs_50.svg ├── openlitespeed-git-icon.png ├── openlitespeed-icon.png ├── ruby_50.svg └── wp_50.svg └── scripts ├── data-storage-node.sh ├── fix-repo-os-name.sh ├── generate_ecc.sh └── oci-image-cleanup /Banner/classicpress: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Configured as part of the 1-Click Image build process 4 | function echoY 5 | { 6 | FLAG=$1 7 | shift 8 | echo -e "\033[38;5;148m$FLAG\033[39m$@" 9 | } 10 | function echoB() 11 | { 12 | FLAG=$1 13 | shift 14 | echo -e "\033[1;4;94m$FLAG\033[0m$@" 15 | } 16 | function echoG 17 | { 18 | FLAG=$1 19 | shift 20 | echo -e "\033[32m$FLAG\033[0m$@" 21 | } 22 | 23 | function echoBOLD 24 | { 25 | FLAG=$1 26 | shift 27 | echo -e "\033[1m$FLAG\033[0m$@" 28 | } 29 | 30 | function echoCYAN 31 | { 32 | FLAG=$1 33 | shift 34 | echo -e "\033[1;36m$FLAG\033[0m$@" 35 | } 36 | 37 | RAM=$(free -m | awk 'NR==2{printf "%s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }') 38 | LOAD=$(uptime | awk -F'[a-z]:' '{ print $2}') 39 | DISK=$(df -h | awk '$NF=="/"{printf "%d/%dGB (%s)\n", $3,$2,$5}') 40 | CPU=$(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}') 41 | if [ -e /sys/devices/virtual/dmi/id/product_uuid ] && [[ "$(sudo cat /sys/devices/virtual/dmi/id/product_uuid | cut -c 1-3)" =~ (EC2|ec2) ]]; then 42 | #MYIP=$(curl http://169.254.169.254/latest/meta-data/public-ipv4) 43 | MYIP=$(curl -s http://checkip.amazonaws.com || printf "0.0.0.0") 44 | elif [ "$(sudo dmidecode -s bios-vendor)" = 'Google' ]; then 45 | MYIP=$(curl -s -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip) 46 | elif [ "$(dmidecode -s system-product-name | cut -c 1-7)" = 'Alibaba' ]; then 47 | MYIP=$(curl -s http://100.100.100.200/latest/meta-data/eipv4) 48 | elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then 49 | MYIP=$(curl -s http://checkip.amazonaws.com || printf "0.0.0.0") 50 | else 51 | MYIP=$(curl -s http://checkip.amazonaws.com || printf "0.0.0.0") 52 | fi 53 | 54 | if [ "$(dmidecode -s bios-vendor)" = 'Vultr' ];then 55 | HMUBUNTU='' 56 | elif [ -e /home/ubuntu ]; then 57 | HMUBUNTU='/home/ubuntu/' 58 | elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then 59 | HMUBUNTU='/root/' 60 | else 61 | HMUBUNTU='' 62 | fi 63 | 64 | clear 65 | cat </dev/null 42 | if [ $? = 0 ]; then 43 | bash <( curl -sk https://raw.githubusercontent.com/digitalocean/marketplace-partners/master/scripts/99-img-check.sh ) 44 | fi 45 | fi 46 | } 47 | 48 | check_root(){ 49 | if [ $(id -u) -ne 0 ]; then 50 | echoR "Please run this script as root user or use sudo" 51 | exit 1 52 | fi 53 | } 54 | 55 | set_ssh_alive(){ 56 | if [ "${PROVIDER}" = 'azure' ]; then 57 | sed -i '/ClientAliveInterval/d' /etc/ssh/sshd_config 58 | echo 'ClientAliveInterval 235' >> /etc/ssh/sshd_config 59 | fi 60 | } 61 | 62 | 63 | stop_aegis(){ 64 | killall -9 aegis_cli aegis_update aegis_cli aegis_quartz >/dev/null 2>&1 65 | killall -9 AliYunDun AliHids AliYunDunUpdate >/dev/null 2>&1 66 | if [ -f "/etc/init.d/aegis" ]; then 67 | /etc/init.d/aegis stop >/dev/null 2>&1 68 | fi 69 | printf "%-40s %40s\n" "Stopping aegis" "[ OK ]" 70 | } 71 | 72 | remove_aegis(){ 73 | if [ -d ${AGENT_PATH} ];then 74 | rm -rf ${AGENT_PATH}/aegis_client 75 | rm -rf ${AGENT_PATH}/aegis_update 76 | rm -rf ${AGENT_PATH}/alihids 77 | rm -rf ${AGENT_PATH}/aegis_quartz 78 | rm -f /etc/init.d/aegis 79 | fi 80 | } 81 | 82 | remove_user(){ 83 | if [ -e /usr/bin/logname ]; then 84 | USER_NAME="$(logname)" 85 | if [ ! -z "${USER_NAME}" ] && [ "${USER_NAME}" != 'root' ] && [ "${USER_NAME}" != 'ubuntu' ] && [ "${USER_NAME}" != 'centos' ]; then 86 | echo "Cleanup user: ${USER_NAME}" 87 | userdel -rf ${USER_NAME} >/dev/null 2>&1 88 | fi 89 | fi 90 | } 91 | 92 | uninstall_aegis(){ 93 | if [ "${PROVIDER}" = 'ali' ]; then 94 | stop_aegis 95 | remove_aegis 96 | fi 97 | } 98 | 99 | install_cloudinit(){ 100 | if [ ! -d ${CLDINITPATH} ]; then 101 | mkdir -p ${CLDINITPATH} 102 | fi 103 | which cloud-init >/dev/null 2>&1 104 | if [ ${?} = 1 ]; then 105 | if [ "${PROVIDER}" = 'ali' ]; then 106 | yum -y install python-pip > /dev/null 2>&1 107 | test -d /etc/cloud && mv /etc/cloud /etc/cloud-old; cd /tmp/ 108 | wget -q http://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/cloudinit/ali-cloud-init-latest.tgz 109 | tar -zxvf ali-cloud-init-latest.tgz > /dev/null 2>&1 110 | OS_VER=$(cat /etc/redhat-release | awk '{printf $4}'| awk -F'.' '{printf $1}') 111 | bash /tmp/cloud-init-*/tools/deploy.sh centos ${OS_VER} 112 | rm -rf ali-cloud-init-latest.tgz cloud-init-* 113 | else 114 | yum install cloud-init -y >/dev/null 2>&1 115 | fi 116 | systemctl start cloud-init >/dev/null 2>&1 117 | systemctl enable cloud-init >/dev/null 2>&1 118 | fi 119 | } 120 | 121 | setup_cloud(){ 122 | cat > ${CLDINITPATH}/per-instance.sh < /dev/null 2>&1 136 | fi 137 | fi 138 | if [ "${OSNAME}" = 'ubuntu' ]; then 139 | sudo apt-get remove unattended-upgrades -y > /dev/null 2>&1 140 | if [ -e /etc/apt/apt.conf.d/10periodic ]; then 141 | sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic 142 | fi 143 | fi 144 | if [ "${PROVIDER}" = 'do' ]; then 145 | apt-get purge droplet-agent -y > /dev/null 2>&1 146 | fi 147 | # Legal 148 | if [ -f /etc/legal ]; then 149 | mv /etc/legal /etc/legal.bk 150 | fi 151 | #empty tmp 152 | mkdir -p /tmp 153 | rm -rf /tmp/* 154 | rm -rf /var/tmp/* 155 | #chmod 1777 /tmp 156 | #cloud-init here 157 | rm -f /var/log/cloud-init.log 158 | rm -f /var/log/cloud-init-output.log 159 | #rm -rf /var/lib/cloud/data 160 | #rm -rf /var/lib/cloud/instance 161 | #rm -rf /var/lib/cloud/instances/* 162 | #system log 163 | rm -rf /var/log/unattended-upgrades 164 | rm -f /var/log/ubuntu-advantage.log* 165 | rm -f /var/log/apt/history.log* 166 | rm -f /var/log/apt/term.log* 167 | rm -f /var/log/apt/eipp.log* 168 | rm -f /var/log/auth.log* 169 | rm -f /var/log/dpkg.log* 170 | rm -f /var/log/kern.log* 171 | rm -f /var/log/ufw.log* 172 | rm -f /var/log/alternatives.log 173 | rm -f /var/log/apport.log 174 | rm -rf /var/log/journal/* 175 | rm -f /var/log/syslog* 176 | rm -f /var/log/btmp* 177 | rm -f /var/log/yum.log* 178 | rm -f /var/log/secure 179 | rm -f /var/log/messages* 180 | rm -f /var/log/dmesg* 181 | rm -f /var/log/audit/audit.log* 182 | rm -f /var/log/maillog* 183 | rm -f /var/tuned/tuned.log 184 | rm -f /var/log/fontconfig.log* 185 | rm -rf /var/log/*.[0-9] 186 | rm -f /var/lib/systemd/random-seed 187 | #aws 188 | rm -rf /var/log/amazon/ssm/* 189 | #azure 190 | rm -f /var/log/azure/* 191 | rm -f /var/log/waagent.log 192 | #ali 193 | rm -f /var/log/ecs_network_optimization.log 194 | #component log 195 | rm -f /usr/local/lscp/logs/* 196 | rm -f /var/log/mail.log* 197 | rm -f /var/log/mail.err 198 | rm -f /var/log/letsencrypt/letsencrypt.log* 199 | rm -f /var/log/fail2ban.log* 200 | rm -f /var/log/mysql/error.log 201 | rm -rf /var/log/*.gz 202 | rm -f /var/log/redis/redis-server.log 203 | rm -rf /usr/local/lsws/logs/* 204 | rm -f /root/.mysql_history 205 | rm -f /var/log/php*.log 206 | rm -f /var/log/installLogs.txt 207 | #Cyberpanel 208 | rm -f /var/log/anaconda/* 209 | rm -f /usr/local/lscp/logs/* 210 | rm -f /usr/local/lscp/cyberpanel/logs/* 211 | rm -rf /usr/local/CyberCP/.idea/* 212 | #key 213 | rm -f /root/.ssh/authorized_keys 214 | rm -f /root/.ssh/cyberpanel* 215 | touch /etc/ssh/revoked_keys 216 | chmod 600 /etc/ssh/revoked_keys 217 | #machine identifier 218 | rm -f /etc/machine-id 219 | touch /etc/machine-id 220 | #history 221 | rm -f /root/.bash_history 222 | cat /dev/null > /var/log/lastlog 223 | rm -f /var/log/wtmp* 224 | unset HISTFILE 225 | #password 226 | rm -f /root/.litespeed_password 227 | 228 | if [ "${PROVIDER}" = 'aws' ]; then 229 | sudo passwd -d root >/dev/null 2>&1 230 | sudo sed -i 's/root::/root:*:/g' /etc/shadow >/dev/null 2>&1 231 | if [ -d /home/ubuntu ]; then 232 | rm -f /home/ubuntu/.mysql_history 233 | rm -f /home/ubuntu/.bash_history 234 | rm -f /home/ubuntu/.ssh/authorized_keys 235 | rm -f /home/ubuntu/.litespeed_password 236 | fi 237 | fi 238 | if [ "${PROVIDER}" = 'google' ] || [ "${PROVIDER}" = 'azure' ]; then 239 | sudo passwd -d root >/dev/null 2>&1 240 | sudo sed -i 's/root::/root:*:/g' /etc/shadow >/dev/null 2>&1 241 | ALL_HMFD=$(ls /home/) 242 | for i in ${ALL_HMFD[@]}; do 243 | if [ "${i}" != 'ubuntu' ] && [ "${i}" != 'cyberpanel' ] && [ "${i}" != 'vmail' ] && [ "${i}" != 'docker' ] && [ "${i}" != 'lscache' ]; then 244 | rm -rf "/home/${i}" 245 | deluser "$i" 246 | fi 247 | done 248 | fi 249 | } 250 | 251 | main_claunch(){ 252 | providerck 253 | check_os 254 | check_root 255 | remove_user 256 | set_ssh_alive 257 | install_cloudinit 258 | setup_cloud 259 | cleanup 260 | valid_do 261 | } 262 | main_claunch 263 | exit 0 -------------------------------------------------------------------------------- /Cloud-init/lsws-instance.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # /******************************************************************** 3 | # LiteSpeed Cloud Script 4 | # @Author: LiteSpeed Technologies, Inc. (https://www.litespeedtech.com) 5 | # @Copyright: (c) 2020-2024 6 | # *********************************************************************/ 7 | LSDIR='/usr/local/lsws' 8 | BANNERNAME='litespeed' 9 | 10 | check_os(){ 11 | if [ -f /etc/redhat-release ] ; then 12 | OSNAME=centos 13 | BANNERDST='/etc/profile.d/99-one-click.sh' 14 | elif [ -f /etc/lsb-release ] ; then 15 | OSNAME=ubuntu 16 | BANNERDST='/etc/update-motd.d/99-one-click' 17 | elif [ -f /etc/debian_version ] ; then 18 | OSNAME=debian 19 | BANNERDST='/etc/update-motd.d/99-one-click' 20 | fi 21 | } 22 | 23 | 24 | check_provider() 25 | { 26 | if [ -e /sys/devices/virtual/dmi/id/product_uuid ] && [[ "$(sudo cat /sys/devices/virtual/dmi/id/product_uuid | cut -c 1-3)" =~ (EC2|ec2) ]]; then 27 | PROVIDER='aws' 28 | elif [ "$(dmidecode -s bios-vendor)" = 'Google' ];then 29 | PROVIDER='google' 30 | elif [ "$(dmidecode -s bios-vendor)" = 'DigitalOcean' ];then 31 | PROVIDER='do' 32 | elif [ "$(dmidecode -s system-product-name | cut -c 1-7)" = 'Alibaba' ];then 33 | PROVIDER='ali' 34 | elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then 35 | PROVIDER='azure' 36 | elif [ -e /etc/oracle-cloud-agent/ ]; then 37 | PROVIDER='oracle' 38 | elif [ -e /root/StackScript ]; then 39 | if grep -q 'linode' /root/StackScript; then 40 | PROVIDER='linode' 41 | fi 42 | else 43 | PROVIDER='undefined' 44 | fi 45 | } 46 | 47 | 48 | os_home_path() 49 | { 50 | if [ ${PROVIDER} = 'aws' ] && [ -d /home/ubuntu ]; then 51 | HMPATH='/home/ubuntu' 52 | PUBIP=$(curl http://169.254.169.254/latest/meta-data/public-ipv4) 53 | elif [ ${PROVIDER} = 'google' ] && [ -d /home/ubuntu ]; then 54 | HMPATH='/home/ubuntu' 55 | PUBIP=$(curl -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip) 56 | elif [ ${PROVIDER} = 'ali' ]; then 57 | HMPATH='/root' 58 | PUBIP=$(curl http://100.100.100.200/latest/meta-data/eipv4) 59 | elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then 60 | HMPATH='/root' 61 | PUBIP=$(curl -s http://checkip.amazonaws.com || printf "0.0.0.0") 62 | else 63 | HMPATH='/root' 64 | PUBIP=$(curl -s http://checkip.amazonaws.com || printf "0.0.0.0") 65 | fi 66 | } 67 | 68 | 69 | ct_version() 70 | { 71 | curl "https://api.quic.cloud/data/1click_ver?t=image&src=aws-lsws" > /dev/null 2>&1 72 | } 73 | 74 | 75 | setup_banner(){ 76 | if [ ! -e ${BANNERDST} ]; then 77 | STATUS="$(curl -s https://raw.githubusercontent.com/litespeedtech/ls-cloud-image/master/Banner/${BANNERNAME} \ 78 | -o ${BANNERDST} -w "%{http_code}")" 79 | if [ ${?} != 0 ] || [ "${STATUS}" != '200' ]; then 80 | curl -s https://cloud.litespeed.sh/Banner/${BANNERNAME} -o ${BANNERDST} 81 | fi 82 | chmod +x ${BANNERDST} 83 | fi 84 | } 85 | 86 | 87 | litespeed_passwordfile(){ 88 | if [ ! -e "${HMPATH}/.litespeed_password" ]; then 89 | touch "${HMPATH}/.litespeed_password" 90 | fi 91 | LSPASSPATH="${HMPATH}/.litespeed_password" 92 | } 93 | 94 | 95 | gen_lsws_pwd() 96 | { 97 | ADMIN_PASS=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 ; echo '') 98 | ENCRYPT_PASS=$(${LSDIR}/admin/fcgi-bin/admin_php5 -q ${LSDIR}/admin/misc/htpasswd.php ${ADMIN_PASS}) 99 | } 100 | 101 | 102 | gen_selfsigned_cert() 103 | { 104 | SSL_HOSTNAME=example 105 | csr="${SSL_HOSTNAME}.csr" 106 | key="${SSL_HOSTNAME}.key" 107 | cert="${SSL_HOSTNAME}.crt" 108 | 109 | 110 | openssl req -new -passin pass:password -passout pass:password -out ${csr} >/dev/null 2>&1 </dev/null 2>&1 122 | openssl rsa -in privkey.pem -passin pass:password -passout pass:password -out ${key} >/dev/null 2>&1 123 | openssl x509 -in ${csr} -out ${cert} -req -signkey ${key} -days 1000 >/dev/null 2>&1 124 | rm -f ${SSL_HOSTNAME}.csr 125 | rm -f privkey.pem 126 | mv ${SSL_HOSTNAME}.crt ${LSDIR}/conf/${SSL_HOSTNAME}.crt 127 | mv ${SSL_HOSTNAME}.key ${LSDIR}/conf/${SSL_HOSTNAME}.key 128 | } 129 | 130 | 131 | web_admin_update(){ 132 | echo "admin:${ENCRYPT_PASS}" > ${LSDIR}/admin/conf/htpasswd 133 | echo "admin_pass=${ADMIN_PASS}" > ${LSPASSPATH} 134 | chmod 600 ${HMPATH}/.litespeed_password 135 | } 136 | 137 | 138 | rm_dummy(){ 139 | if [ "${OSNAME}" = 'ubuntu' ] || [ "${OSNAME}" = 'debian' ]; then 140 | rm -f /etc/update-motd.d/00-header 141 | rm -f /etc/update-motd.d/10-help-text 142 | rm -f /etc/update-motd.d/50-landscape-sysinfo 143 | rm -f /etc/update-motd.d/50-motd-news 144 | rm -f /etc/update-motd.d/51-cloudguest 145 | rm -f /etc/profile.d/cyberpanel.sh 146 | if [ -f /etc/legal ]; then 147 | mv /etc/legal /etc/legal.bk 148 | fi 149 | if [ "${PROVIDER}" = 'ali' ]; then 150 | mv /etc/motd /etc/motd.bk 151 | fi 152 | fi 153 | } 154 | 155 | 156 | add_hosts(){ 157 | if [ -d /home/ubuntu ]; then 158 | NEWKEY="127.0.0.1 localhost $(hostname)" 159 | linechange '127.0.0.1' /etc/hosts "${NEWKEY}" 160 | fi 161 | } 162 | 163 | 164 | setupLicense(){ 165 | if [[ -e '/usr/local/lsws/conf/trial.key' ]]; then 166 | rm -rf /usr/local/lsws/conf/trial.key 167 | fi 168 | curl http://license.litespeedtech.com/reseller/trial.key > /usr/local/lsws/conf/trial.key 169 | ${LSDIR}/bin/lshttpd -r 170 | /usr/bin/systemctl restart lsws 171 | } 172 | 173 | maincloud(){ 174 | check_os 175 | check_provider 176 | os_home_path 177 | gen_selfsigned_cert 178 | setup_banner 179 | litespeed_passwordfile 180 | ct_version 181 | gen_lsws_pwd 182 | web_admin_update 183 | add_hosts 184 | setupLicense 185 | rm_dummy 186 | } 187 | 188 | maincloud 189 | rm -f ${CLOUDPERINSTPATH}/per-instance.sh -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ls-cloud-image 2 | [](https://github.com/litespeedtech/ls-cloud-image/graphs/contributors) 3 | [](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) 4 | [](litespeedtech.com/slack) 5 | [](https://twitter.com/litespeedtech) 6 | 7 | ## Launch an Existing Cloud Image 8 | Look [here](https://docs.litespeedtech.com/cloud/images/) if you are interested in launching existing images from popular cloud platforms 9 | 10 | | Cloud | [](https://docs.litespeedtech.com/cloud/images/wordpress/) | [](https://docs.litespeedtech.com/cloud/images/cyberpanel/) | [](https://docs.litespeedtech.com/cloud/images/django/) | [](https://docs.litespeedtech.com/cloud/images/nodejs/) | [](https://docs.litespeedtech.com/cloud/images/ruby/)| [](https://docs.litespeedtech.com/lsws/)| 11 | | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: | 12 | ||[WordPress Instructions](https://docs.litespeedtech.com/cloud/images/wordpress/)|[CyberPanel Instructions](https://docs.litespeedtech.com/cloud/images/cyberpanel/)|[Django Instructions](https://docs.litespeedtech.com/cloud/images/django/)|[Node.js Instructions](https://docs.litespeedtech.com/cloud/images/nodejs/)|[Rails Instructions](https://docs.litespeedtech.com/cloud/images/rails/)|[LiteSpeed Instructions](https://www.litespeedtech.com/)| 13 | |[**DigitalOcean**](https://marketplace.digitalocean.com/category/blogs-and-forums) | [Launch](https://marketplace.digitalocean.com/apps/openlitespeed-wordpress) | [Launch](https://marketplace.digitalocean.com/apps/cyberpanel) | [Launch](https://marketplace.digitalocean.com/apps/openlitespeed-django) | [Launch](https://marketplace.digitalocean.com/apps/openlitespeed-nodejs) | [Launch](https://marketplace.digitalocean.com/apps/openlitespeed-rails) | - | 14 | |[**GCP**](https://console.cloud.google.com/marketplace/browse?q=litespeed)|[Launch](https://console.cloud.google.com/marketplace/product/gc-image-pub/openlitespeed-with-wordpress)| [Launch](https://console.cloud.google.com/marketplace/product/gc-image-pub/cyberpanel-official) | [Launch](https://console.cloud.google.com/marketplace/details/gc-image-pub/django-with-openlitespeed) | [Launch](https://console.cloud.google.com/marketplace/details/gc-image-pub/nodejs-with-openlitespeed) |[Launch](https://console.cloud.google.com/marketplace/details/gc-image-pub/rails-with-openlitespeed)|[Launch](https://console.cloud.google.com/marketplace/product/gc-image-pub/litespeed-web-server)| 15 | |[**AWS**](https://aws.amazon.com/marketplace/search/results?x=0&y=0&searchTerms=litespeed)|[Launch](https://aws.amazon.com/marketplace/pp/prodview-welmqpneba3qa)|[Launch](https://aws.amazon.com/marketplace/pp/prodview-afkzr2wjcxhr6)|[Launch](https://aws.amazon.com/marketplace/pp/prodview-sxcjpp6tgoucs)|[Launch](https://aws.amazon.com/marketplace/pp/prodview-anhqfjcd4jdhu)|[Launch](https://aws.amazon.com/marketplace/pp/prodview-igywskxti4sls)|[Launch](https://aws.amazon.com/marketplace/pp/prodview-jekwzwpttueu2)| 16 | |[**Azure**](https://azuremarketplace.microsoft.com/en-us/marketplace/apps?search=litespeed)|[Launch](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/litespeedtechnologies.openlitespeed-wordpress)|[Launch](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/litespeedtechnologies.cyberpanel)|[Launch](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/litespeedtechnologies.openlitespeed-django)| [Launch](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/litespeedtechnologies.openlitespeed-nodejs) |[Launch](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/litespeedtechnologies.openlitespeed-rails)|[Launch](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/litespeedtechnologies.litespeed)| 17 | |[**Alibaba**](https://marketplace.alibabacloud.com/products?keywords=litespeed)|[Launch](https://marketplace.alibabacloud.com/products/56720001/sgcmjj00024846.html)|[Launch](https://marketplace.alibabacloud.com/products/56720001/sgcmjj00024863.html)|[Launch](https://marketplace.alibabacloud.com/products/56720001/OpenLiteSpeed_em_Django_em_-sgcmjj00024874.html)|[Launch](https://marketplace.alibabacloud.com/products/56720001/sgcmjj00024862.html)|[Launch](https://marketplace.alibabacloud.com/products/56720001/sgcmjj00024972.html)| - | 18 | |[**Linode**](https://www.linode.com/marketplace/apps/?sq=litespeed)|[Launch](https://www.linode.com/marketplace/apps/litespeed-technologies/openlitespeed-wordpress/)|[Launch](https://www.linode.com/marketplace/apps/litespeed-technologies/cyberpanel/)|[Launch](https://www.linode.com/marketplace/apps/litespeed-technologies/openlitespeed-django/)|[Launch](https://www.linode.com/marketplace/apps/litespeed-technologies/openlitespeed-nodejs/)|[Launch](https://www.linode.com/marketplace/apps/litespeed-technologies/openlitespeed-rails/)|[Launch](https://www.linode.com/marketplace/apps/litespeed-technologies/litespeed-cpanel/)| 19 | |[**Vultr**](https://www.vultr.com/marketplace/)|[Launch](https://www.vultr.com/marketplace/apps/openlitespeed-wordpress)|[Launch](https://www.vultr.com/marketplace/apps/cyberpanel)|[Launch](https://www.vultr.com/marketplace/apps/openlitespeed-django)|[Launch](https://www.vultr.com/marketplace/apps/openlitespeed-nodejs)|[Launch](https://www.vultr.com/marketplace/apps/openlitespeed-rails)|-| 20 | 21 | |||| 22 | | :-------------: | :-------------: | :-------------: | 23 | | |[](https://docs.litespeedtech.com/cloud/images/drupal/)|[](https://docs.litespeedtech.com/cloud/images/joomla/) | 24 | ||[Drupal Instructions](https://docs.litespeedtech.com/cloud/images/drupal/)|[Joomla Instructions](https://docs.litespeedtech.com/cloud/images/joomla/)| 25 | | [**DigitalOcean**](https://marketplace.digitalocean.com/category/blogs-and-forums) | [Launch](https://marketplace.digitalocean.com/apps/openlitespeed-drupal) | [Launch](https://marketplace.digitalocean.com/apps/openlitespeed-joomla) | 26 | | [**Vultr**](https://www.vultr.com/marketplace/) | [Launch](https://www.vultr.com/marketplace/apps/openlitespeed-drupal) | [Launch](https://www.vultr.com/marketplace/apps/openlitespeed-joomla) | 27 | | [**GCP**](https://console.cloud.google.com/marketplace/browse?q=litespeed)| [Launch](https://console.cloud.google.com/marketplace/product/gc-image-pub/drupal-with-openlitespeed) | [Launch](https://console.cloud.google.com/marketplace/product/click-to-deploy-images/joomla-with-openlitespeed) | 28 | | [**AWS**](https://aws.amazon.com/marketplace/search/results?x=0&y=0&searchTerms=litespeed) | [Launch](https://aws.amazon.com/marketplace/pp/prodview-tflmo6zbpxw3e) | [Launch](https://aws.amazon.com/marketplace/pp/prodview-2t4obkb4imsww) | 29 | |[**Linode**](https://cloud.linode.com/stackscripts/)|[Launch](https://cloud.linode.com/stackscripts/1147654)|[Launch](https://cloud.linode.com/stackscripts/1147653)| 30 | 31 | 32 | ## Custom Build Your One-Click On Any Cloud 33 | You don't need to stick with our prebuilt cloud images. You can create your own one-click for any cloud platform that you like! Use our easy-to-follow documentation to build an image yourself. 34 | 35 | 1. Launch a base image, e.g. Ubuntu 22.04 36 | 2. Install a setup script 37 | 3. Install a launch script 38 | 4. Build Image 39 | 40 | |||||| 41 | |:--:|:--:|:--:|:--:|:--:| 42 | | Build | [    
WordPress ](https://github.com/litespeedtech/ls-cloud-image/wiki/Build-WordPress-Image) | [    
CyberPanel ](https://github.com/litespeedtech/ls-cloud-image/wiki/Build-CyberPanel-Image) | [    
Drupal](https://github.com/litespeedtech/ls-cloud-image/wiki/Build-Drupal-Image) | [    
Joomla](https://github.com/litespeedtech/ls-cloud-image/wiki/Build-Joomla-Image) | 43 | | Build | [    
Django ](https://github.com/litespeedtech/ls-cloud-image/wiki/Build-Django-Image) | [    
NodeJS](https://github.com/litespeedtech/ls-cloud-image/wiki/Build-NodeJS-Image) | [    
Rails](https://github.com/litespeedtech/ls-cloud-image/wiki/Build-Rails-Image) | | 44 | -------------------------------------------------------------------------------- /Setup/conf/ols2ent/example.conf: -------------------------------------------------------------------------------- 1 | 2 | ServerName replacement_domain 3 | ServerAlias replacement_alias 4 | ServerAdmin replacement_adminemail 5 | SuexecUserGroup replacement_user replacement_group 6 | DocumentRoot replacement_docroot 7 | CustomLog replacement_log combined 8 | php_my_admin_directive 9 | AddHandler application/x-httpd-replacement_php_ver .php .php7 .phtml 10 | 11 | CacheRoot lscache 12 | 13 | 14 | 15 | 16 | 17 | ServerName replacement_domain 18 | ServerAlias replacement_alias 19 | ServerAdmin replacement_adminemail 20 | SuexecUserGroup replacement_user replacement_group 21 | DocumentRoot replacement_docroot 22 | CustomLog replacement_log combined 23 | php_my_admin_directive 24 | 25 | CacheRoot lscache 26 | 27 | SSLEngine on 28 | SSLVerifyClient none 29 | SSLCertificateFile replacement_cert_file 30 | SSLCertificateKeyFile replacement_key_file 31 | AddHandler application/x-httpd-replacement_php_ver .php .php7 .phtml 32 | 33 | -------------------------------------------------------------------------------- /Setup/conf/ols2ent/httpd.conf: -------------------------------------------------------------------------------- 1 | ServerRoot "/usr/local/lsws" 2 | 3 | Listen 0.0.0.0:80 4 | Listen [::]:80 5 | Listen 0.0.0.0:443 6 | Listen [::]:443 7 | 8 | User nobody 9 | Group nobody 10 | ServerAdmin root@localhost 11 | 12 | 13 | AllowOverride none 14 | 15 | 16 | 17 | AllowOverride All 18 | Options +Includes -Indexes +ExecCGI 19 | 20 | 21 | DirectoryIndex index.php index.html 22 | 23 | 24 | Require all denied 25 | 26 | 27 | ErrorLog "/usr/local/lsws/logs/error.log" 28 | LogLevel warn 29 | 30 | LogFormat '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"' combined 31 | CustomLog "/usr/local/lsws/logs/access.log" combined 32 | 33 | 34 | AddType application/x-compress .Z 35 | AddType application/x-gzip .gz .tgz 36 | AddType text/html .shtml 37 | AddOutputFilter INCLUDES .shtml 38 | 39 | AddDefaultCharset UTF-8 40 | 41 | 42 | MIMEMagicFile conf/magic 43 | 44 | 45 | EnableSendfile on 46 | 47 | SSLProtocol all -SSLv3 -TLSv1 48 | SSLHonorCipherOrder on 49 | 50 | SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:HIGH:!EDH-RSA-DES-CBC3-SHA:!DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4 51 | 52 | 53 | CacheRoot /usr/local/lsws/cachedata/ 54 | 55 | 56 | Include /usr/local/lsws/conf/vhosts/* 57 | 58 | 59 | ServerName replacement_servername 60 | ServerAdmin replacement_adminemail 61 | SuexecUserGroup replacement_user replacement_group 62 | DocumentRoot /var/www/html/ 63 | CustomLog /usr/local/lsws/logs/wordpress-access.log combined 64 | Alias /phpmyadmin/ /var/www/phpmyadmin/ 65 | AddHandler application/x-httpd-php73 .php .php7 .phtml 66 | 67 | CacheRoot lscache 68 | 69 | 70 | 71 | 72 | ServerName replacement_servername 73 | ServerAdmin replacement_adminemail 74 | SuexecUserGroup replacement_user replacement_group 75 | DocumentRoot /var/www/html/ 76 | CustomLog /usr/local/lsws/logs/wordpress-access.log combined 77 | Alias /phpmyadmin/ /var/www/phpmyadmin/ 78 | 79 | CacheRoot lscache 80 | 81 | SSLEngine on 82 | SSLVerifyClient none 83 | SSLCertificateFile replacement_cert_file 84 | SSLCertificateKeyFile replacement_key_file 85 | AddHandler application/x-httpd-php73 .php .php7 .phtml 86 | 87 | -------------------------------------------------------------------------------- /Setup/conf/ols2ent/httpd_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $HOSTNAME 4 | nobody 5 | nobody 6 | 0 7 | / 8 | 0 9 | 120M 10 | /tmp/lshttpd/swap 11 | 1 12 | 1 13 | 0 14 | /usr/local/lsws/conf/httpd.conf 15 | 0 16 | 0 17 | 2 18 | 15 19 | $SERVER_ROOT/conf/mime.properties 20 | 0 21 | 86400 22 | 1 23 | admin@localhost 24 | 25 | 26 | $SERVER_ROOT/logs/error.log 27 | DEBUG 28 | 0 29 | 10M 30 | 1 31 | 1 32 | 33 | 34 | $SERVER_ROOT/logs/access.log 35 | 10M 36 | 30 37 | 0 38 | 39 | 40 | index.html, index.php 41 | 42 | 0 43 | .htaccess 44 | 45 | 46 | 1 47 | image/*=A604800, text/css=A604800, application/x-javascript=A604800, application/javascript=A604800,font/*=A604800,application/x-font-ttf=A604800 48 | 49 | 50 | 10000 51 | 10000 52 | 300 53 | 10000 54 | 5 55 | 0 56 | 0 57 | 8192 58 | 16380 59 | 500M 60 | 8K 61 | 500M 62 | 4096 63 | 20M 64 | 256K 65 | 40M 66 | 1 67 | 1 68 | 4 69 | 1 70 | text/*,application/x-javascript,application/javascript,application/xml,image/svg+xml,application/rss+xml 71 | 1 72 | 1 73 | 74 | 75 | 76 | 1 77 | 0 78 | 000 79 | 000 80 | 81 | 82 | 0 83 | 0 84 | 0 85 | 0 86 | 10000 87 | 10000 88 | 15 89 | 300 90 | 91 | 92 | 200 93 | 11 94 | 10 95 | 0 96 | 300 97 | 600 98 | 1450M 99 | 1500M 100 | 1400 101 | 1450 102 | 103 | 104 | 0 105 | 0 106 | deny,log,status:403 107 | 1 108 | 109 | 110 | / 111 | /etc/* 112 | /dev/* 113 | $SERVER_ROOT/conf/* 114 | $SERVER_ROOT/admin/conf/* 115 | 116 | 117 | ALL 118 | 119 | 120 | 121 | 35 122 | PHP_LSAPI_CHILDREN=35 123 | 60 124 | 0 125 | 1 126 | 0 127 | 60 128 | 2047M 129 | 2047M 130 | 400 131 | 500 132 | 133 | 134 | 5 135 | LSAPI_MAX_IDLE=60 136 | 180 137 | 0 138 | 60 139 | 0 140 | 50 141 | 1 142 | 3 143 | 2047M 144 | 2047M 145 | 400 146 | 500 147 | 148 | 149 | -------------------------------------------------------------------------------- /Setup/cyberjoomlasetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # /******************************************************************** 3 | # LiteSpeed CyberPanel Joomla setup Script 4 | # @Author: LiteSpeed Technologies, Inc. (https://www.litespeedtech.com) 5 | # @Version: 1.0.1 6 | # *********************************************************************/ 7 | 8 | NOWPATH=$(pwd) 9 | APPNAME_PATH='/opt/.app_name' 10 | 11 | echoY() { 12 | echo -e "\033[38;5;148m${1}\033[39m" 13 | } 14 | echoG() { 15 | echo -e "\033[38;5;71m${1}\033[39m" 16 | } 17 | echoR() 18 | { 19 | echo -e "\033[38;5;203m${1}\033[39m" 20 | } 21 | 22 | providerck() 23 | { 24 | if [ -e /sys/devices/virtual/dmi/id/product_uuid ] && [[ "$(sudo cat /sys/devices/virtual/dmi/id/product_uuid | cut -c 1-3)" =~ (EC2|ec2) ]]; then 25 | PROVIDER='aws' 26 | elif [ "$(dmidecode -s bios-vendor)" = 'Google' ];then 27 | PROVIDER='google' 28 | elif [ "$(dmidecode -s bios-vendor)" = 'DigitalOcean' ];then 29 | PROVIDER='do' 30 | elif [ "$(dmidecode -s bios-vendor)" = 'Vultr' ];then 31 | PROVIDER='vultr' 32 | elif [ "$(dmidecode -s system-product-name | cut -c 1-7)" = 'Alibaba' ];then 33 | PROVIDER='aliyun' 34 | elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then 35 | PROVIDER='azure' 36 | elif [ -e /etc/oracle-cloud-agent/ ]; then 37 | PROVIDER='oracle' 38 | else 39 | PROVIDER='undefined' 40 | fi 41 | } 42 | 43 | check_os() 44 | { 45 | if [ -f /etc/redhat-release ] ; then 46 | OSVER=$(cat /etc/redhat-release | awk '{print substr($4,1,1)}') 47 | OSNAME=centos 48 | elif [ -f /etc/lsb-release ] ; then 49 | OSNAME=ubuntu 50 | elif [ -f /etc/debian_version ] ; then 51 | OSNAME=debian 52 | fi 53 | } 54 | 55 | upgrade() { 56 | echoG 'Updating system' 57 | if [ "${OSNAME}" = 'ubuntu' ] || [ "${OSNAME}" = 'debian' ]; then 58 | apt-get update > /dev/null 2>&1 59 | echo -ne '##### (33%)\r' 60 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' upgrade > /dev/null 2>&1 61 | echo -ne '############# (66%)\r' 62 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade > /dev/null 2>&1 63 | echo -ne '#################### (99%)\r' 64 | apt-get clean > /dev/null 2>&1 65 | apt-get autoclean > /dev/null 2>&1 66 | echo -ne '####################### (100%)\r' 67 | else 68 | echo -ne '# (5%)\r' 69 | yum update -y > /dev/null 2>&1 70 | echo -ne '####################### (100%)\r' 71 | fi 72 | echoG 'Finish Update' 73 | } 74 | 75 | install_basic_pkg(){ 76 | if [ "${OSNAME}" = 'centos' ]; then 77 | yum -y install wget > /dev/null 2>&1 78 | else 79 | apt-get -y install wget > /dev/null 2>&1 80 | fi 81 | } 82 | 83 | install_cyberpanel(){ 84 | echoG 'Installing CyberPanel' 85 | ### The 1 1 will auto answer the prompt to install CyberPanel and OpenLiteSpeed 86 | ### and then accept the default values for the rest of the questions. 87 | cd /opt/; wget -q https://cyberpanel.net/install.sh 88 | chmod +x install.sh 89 | printf "%s\n" 1 1 | bash install.sh 90 | echoG 'Finish CyberPanel' 91 | rm -rf cyberpanel cyberpanel.sh install.sh requirements.txt 92 | } 93 | 94 | joomla_version3(){ 95 | if [ -e /usr/local/CyberCP/plogical/applicationInstaller.py ]; then 96 | grep 'skip-create-statement' /usr/local/CyberCP/plogical/applicationInstaller.py | grep release >/dev/null 97 | if [ ${?} = 1 ]; then 98 | sed -i 's/--skip-create-statement/--skip-create-statement --release=3/g' /usr/local/CyberCP/plogical/applicationInstaller.py 99 | fi 100 | fi 101 | } 102 | 103 | app_file(){ 104 | echoG 'Setup App Name file' 105 | if [ ! -e "${APPNAME_PATH}" ]; then 106 | touch "${APPNAME_PATH}" 107 | echo 'cyberpanel-joomla' > "${APPNAME_PATH}" 108 | else 109 | echoR "${APPNAME_PATH} exist, please check!" 110 | fi 111 | } 112 | 113 | rm_agpl_pkg(){ 114 | local RAINLOOP_PATH='/usr/local/CyberCP/public/rainloop' 115 | if [ -e ${RAINLOOP_PATH} ]; then 116 | rm -rf ${RAINLOOP_PATH} 117 | fi 118 | if [ "${OSNAME}" = 'ubuntu' ] || [ "${OSNAME}" = 'debian' ]; then 119 | apt remove ghostscript unattended-upgrades -y 120 | else 121 | yum remove ghostscript -y 122 | fi 123 | } 124 | 125 | special_fstab(){ 126 | if [ "${PROVIDER}" = 'vultr' ]; then 127 | sed -ie '/tmp/ s/^#*/#/' /etc/fstab 128 | fi 129 | } 130 | 131 | rmdummy(){ 132 | rm -f ${NOWPATH}/cyberpanel.sh 133 | rm -rf ${NOWPATH}/install* 134 | rm -rf /usr/local/CyberCP/.idea/ 135 | rm -f /etc/profile.d/cyberpanel.sh 136 | } 137 | 138 | main(){ 139 | START_TIME="$(date -u +%s)" 140 | check_os 141 | providerck 142 | upgrade 143 | install_basic_pkg 144 | install_cyberpanel 145 | joomla_version3 146 | app_file 147 | rm_agpl_pkg 148 | special_fstab 149 | rmdummy 150 | END_TIME="$(date -u +%s)" 151 | ELAPSED="$((${END_TIME}-${START_TIME}))" 152 | echoY "***Total of ${ELAPSED} seconds to finish process***" 153 | } 154 | 155 | main 156 | exit 0 157 | 158 | -------------------------------------------------------------------------------- /Setup/cybersetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # /******************************************************************** 3 | # LiteSpeed CyberPanel setup Script 4 | # @Author: LiteSpeed Technologies, Inc. (https://www.litespeedtech.com) 5 | # @Version: 1.0.3 6 | # *********************************************************************/ 7 | Sudo_Test=$(set) 8 | NOWPATH=$(pwd) 9 | 10 | echoY() { 11 | echo -e "\033[38;5;148m${1}\033[39m" 12 | } 13 | echoG() { 14 | echo -e "\033[38;5;71m${1}\033[39m" 15 | } 16 | echoR() 17 | { 18 | echo -e "\033[38;5;203m${1}\033[39m" 19 | } 20 | 21 | providerck() 22 | { 23 | if [ -e /sys/devices/virtual/dmi/id/product_uuid ] && [[ "$(sudo cat /sys/devices/virtual/dmi/id/product_uuid | cut -c 1-3)" =~ (EC2|ec2) ]]; then 24 | PROVIDER='aws' 25 | elif [ "$(dmidecode -s bios-vendor)" = 'Google' ];then 26 | PROVIDER='google' 27 | elif [ "$(dmidecode -s bios-vendor)" = 'DigitalOcean' ];then 28 | PROVIDER='do' 29 | elif [ "$(dmidecode -s bios-vendor)" = 'Vultr' ];then 30 | PROVIDER='vultr' 31 | elif [ "$(dmidecode -s system-product-name | cut -c 1-7)" = 'Alibaba' ];then 32 | PROVIDER='aliyun' 33 | elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then 34 | PROVIDER='azure' 35 | elif [ -e /etc/oracle-cloud-agent/ ]; then 36 | PROVIDER='oracle' 37 | else 38 | PROVIDER='undefined' 39 | fi 40 | } 41 | 42 | check_root() 43 | { 44 | echoG "Checking root privileges..." 45 | if echo "$Sudo_Test" | grep SUDO >/dev/null; then 46 | echoR "You are using SUDO , please run as root user..." 47 | echo -e "\nIf you don't have direct access to root user, please run \e[31msudo su -\e[39m command (do NOT miss the \e[31m-\e[39m at end or it will fail) and then run installation command again." 48 | exit 1 49 | fi 50 | 51 | if [[ $(id -u) != 0 ]] >/dev/null; then 52 | echoR "You must run on root user to install CyberPanel or run following command: (do NOT miss the quotes)" 53 | echo -e "\e[31msudo su -c \"sh <(curl https://cyberpanel.sh || wget -O - https://cyberpanel.sh)\"\e[39m" 54 | exit 1 55 | else 56 | echoG "Runing script with root user" 57 | fi 58 | } 59 | 60 | check_os() 61 | { 62 | if [ -f /etc/redhat-release ] ; then 63 | OSVER=$(cat /etc/redhat-release | awk '{print substr($4,1,1)}') 64 | OSNAME=centos 65 | elif [ -f /etc/lsb-release ] ; then 66 | OSNAME=ubuntu 67 | elif [ -f /etc/debian_version ] ; then 68 | OSNAME=debian 69 | fi 70 | } 71 | 72 | upgrade() { 73 | echoG 'Updating system' 74 | if [ "${OSNAME}" = 'ubuntu' ] || [ "${OSNAME}" = 'debian' ]; then 75 | apt-get update > /dev/null 2>&1 76 | echo -ne '##### (33%)\r' 77 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' upgrade > /dev/null 2>&1 78 | echo -ne '############# (66%)\r' 79 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade > /dev/null 2>&1 80 | echo -ne '#################### (99%)\r' 81 | apt-get clean > /dev/null 2>&1 82 | apt-get autoclean > /dev/null 2>&1 83 | echo -ne '####################### (100%)\r' 84 | else 85 | echo -ne '# (5%)\r' 86 | yum update -y > /dev/null 2>&1 87 | echo -ne '####################### (100%)\r' 88 | fi 89 | echoG 'Finish Update' 90 | } 91 | 92 | install_basic_pkg(){ 93 | if [ "${OSNAME}" = 'centos' ]; then 94 | yum -y install wget > /dev/null 2>&1 95 | else 96 | apt-get -y install wget > /dev/null 2>&1 97 | fi 98 | } 99 | 100 | install_cyberpanel(){ 101 | echoG 'Installing CyberPanel' 102 | ### The 1 1 will auto answer the prompt to install CyberPanel and OpenLiteSpeed 103 | ### and then accept the default values for the rest of the questions. 104 | cd /opt/; wget -q https://cyberpanel.net/install.sh 105 | chmod +x install.sh 106 | printf "%s\n" 1 1 | bash install.sh 107 | echoG 'Finish CyberPanel' 108 | rm -rf cyberpanel cyberpanel.sh install.sh requirements.txt 109 | } 110 | 111 | rm_agpl_pkg(){ 112 | local RAINLOOP_PATH='/usr/local/CyberCP/public/rainloop' 113 | if [ -e ${RAINLOOP_PATH} ]; then 114 | rm -rf ${RAINLOOP_PATH} 115 | fi 116 | if [ "${OSNAME}" = 'ubuntu' ] || [ "${OSNAME}" = 'debian' ]; then 117 | apt remove ghostscript unattended-upgrades -y 118 | else 119 | yum remove ghostscript -y 120 | fi 121 | } 122 | 123 | special_fstab(){ 124 | if [ "${PROVIDER}" = 'vultr' ]; then 125 | sed -ie '/tmp/ s/^#*/#/' /etc/fstab 126 | fi 127 | } 128 | 129 | rmdummy(){ 130 | rm -f ${NOWPATH}/cyberpanel.sh 131 | rm -rf ${NOWPATH}/install* 132 | rm -rf /usr/local/CyberCP/.idea/ 133 | rm -f /etc/profile.d/cyberpanel.sh 134 | } 135 | 136 | main(){ 137 | START_TIME="$(date -u +%s)" 138 | check_root 139 | check_os 140 | providerck 141 | upgrade 142 | install_basic_pkg 143 | install_cyberpanel 144 | rm_agpl_pkg 145 | special_fstab 146 | rmdummy 147 | END_TIME="$(date -u +%s)" 148 | ELAPSED="$((${END_TIME}-${START_TIME}))" 149 | echoY "***Total of ${ELAPSED} seconds to finish process***" 150 | } 151 | 152 | main 153 | exit 0 154 | 155 | -------------------------------------------------------------------------------- /Setup/domainsetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # /******************************************************************** 3 | # LiteSpeed domain setup Script 4 | # @Author: LiteSpeed Technologies, Inc. (https://www.litespeedtech.com) 5 | # *********************************************************************/ 6 | DOMAIN='' 7 | WWW_DOMAIN='' 8 | DOCHM='/var/www/html' 9 | LSDIR='/usr/local/lsws' 10 | WEBCF="${LSDIR}/conf/httpd_config.conf" 11 | if [ -e "${LSDIR}/conf/vhosts/wordpress/vhconf.conf" ]; then 12 | VHNAME='wordpress' 13 | elif [ -e "${LSDIR}/conf/vhosts/classicpress/vhconf.conf" ]; then 14 | VHNAME='classicpress' 15 | elif [ -e "${LSDIR}/conf/vhosts/joomla/vhconf.conf" ]; then 16 | VHNAME='joomla' 17 | elif [ -e "${LSDIR}/conf/vhosts/drupal/vhconf.conf" ]; then 18 | VHNAME='drupal' 19 | DOCHM='/var/www/html/web' 20 | else 21 | VHNAME='Example' 22 | DOCHM="${LSDIR}/${VHNAME}/html" 23 | fi 24 | LSVHCFPATH="${LSDIR}/conf/vhosts/${VHNAME}/vhconf.conf" 25 | UPDATELIST='/var/lib/update-notifier/updates-available' 26 | BOTCRON='/etc/cron.d/certbot' 27 | WWW='FALSE' 28 | UPDATE='TRUE' 29 | OSNAME='' 30 | 31 | echoY() { 32 | echo -e "\033[38;5;148m${1}\033[39m" 33 | } 34 | echoG() { 35 | echo -e "\033[38;5;71m${1}\033[39m" 36 | } 37 | 38 | echoB(){ 39 | echo -e "\033[1;34m${1}\033[0m" 40 | } 41 | 42 | check_os(){ 43 | if [ -f /etc/redhat-release ] ; then 44 | OSNAME=centos 45 | OSVER=$(cat /etc/redhat-release | awk '{print substr($4,1,1)}') 46 | BOTCRON='/etc/crontab' 47 | elif [ -f /etc/lsb-release ] ; then 48 | OSNAME=ubuntu 49 | elif [ -f /etc/debian_version ] ; then 50 | OSNAME=debian 51 | fi 52 | } 53 | 54 | providerck() 55 | { 56 | if [ -e /sys/devices/virtual/dmi/id/product_uuid ] && [[ "$(sudo cat /sys/devices/virtual/dmi/id/product_uuid | cut -c 1-3)" =~ (EC2|ec2) ]]; then 57 | PROVIDER='aws' 58 | elif [ -d /proc/vz/ ]; then 59 | PROVIDER='vm' 60 | elif [ "$(dmidecode -s bios-vendor)" = 'Google' ];then 61 | PROVIDER='google' 62 | elif [ "$(dmidecode -s bios-vendor)" = 'DigitalOcean' ];then 63 | PROVIDER='do' 64 | elif [ "$(dmidecode -s system-product-name | cut -c 1-7)" = 'Alibaba' ];then 65 | PROVIDER='aliyun' 66 | elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then 67 | PROVIDER='azure' 68 | elif [ -e /etc/oracle-cloud-agent/ ]; then 69 | PROVIDER='oracle' 70 | else 71 | PROVIDER='undefined' 72 | fi 73 | } 74 | 75 | get_ip() 76 | { 77 | if [ ${PROVIDER} = 'vm' ]; then 78 | MY_IP=$(curl -s http://checkip.amazonaws.com || printf "0.0.0.0") 79 | elif [ ${PROVIDER} = 'aws' ]; then 80 | MY_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4) 81 | elif [ ${PROVIDER} = 'google' ]; then 82 | MY_IP=$(curl -s -H "Metadata-Flavor: Google" \ 83 | http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip) 84 | elif [ ${PROVIDER} = 'aliyun' ]; then 85 | MY_IP=$(curl -s http://100.100.100.200/latest/meta-data/eipv4) 86 | elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then 87 | MY_IP=$(curl -s http://checkip.amazonaws.com || printf "0.0.0.0") 88 | else 89 | MY_IP=$(curl -s http://checkip.amazonaws.com || printf "0.0.0.0") 90 | fi 91 | } 92 | 93 | domainhelp(){ 94 | echoB "To visit your apps by domain instead of IP, please enter a valid domain." 95 | echoB "If you don't have one yet, you may cancel this process by pressing CTRL+C and continuing to SSH." 96 | echoB "This prompt will open again the next time you log in, and will continue to do so until you finish the setup." 97 | echoB "Make sure the domain's DNS record has been properly pointed to this server." 98 | echo -e "Enter the root domain only, then the system will add both the root domain and the www domain for you." 99 | } 100 | 101 | restart_lsws(){ 102 | ${LSDIR}/bin/lswsctrl stop >/dev/null 2>&1 103 | systemctl stop lsws >/dev/null 2>&1 104 | systemctl start lsws >/dev/null 2>&1 105 | } 106 | 107 | domain_filter(){ 108 | DOMAIN="${1}" 109 | DOMAIN="${DOMAIN#http://}" 110 | DOMAIN="${DOMAIN#https://}" 111 | DOMAIN="${DOMAIN#ftp://}" 112 | DOMAIN="${DOMAIN#scp://}" 113 | DOMAIN="${DOMAIN#scp://}" 114 | DOMAIN="${DOMAIN#sftp://}" 115 | DOMAIN=${DOMAIN%%/*} 116 | } 117 | 118 | domaininput(){ 119 | printf "%s" "Your domain: " 120 | read DOMAIN 121 | if [ -z "${DOMAIN}" ] ; then 122 | echo -e "\nPlease input a valid domain\n" 123 | exit 1 124 | fi 125 | domain_filter ${DOMAIN} 126 | echo -e "The domain you put is: \e[31m${DOMAIN}\e[39m" 127 | printf "%s" "Please verify it is correct. [y/N] " 128 | } 129 | 130 | duplicateck(){ 131 | grep "${1}" ${2} >/dev/null 2>&1 132 | } 133 | 134 | www_domain(){ 135 | CHECK_WWW=$(echo ${1} | cut -c1-4) 136 | if [[ ${CHECK_WWW} == www. ]] ; then 137 | DOMAIN=$(echo ${1} | cut -c 5-) 138 | else 139 | DOMAIN=${1} 140 | fi 141 | WWW_DOMAIN="www.${DOMAIN}" 142 | } 143 | 144 | domainadd(){ 145 | duplicateck ${DOMAIN} ${WEBCF} 146 | if [ ${?} = 1 ]; then 147 | if [ ${PROVIDER} = 'do' ]; then 148 | sed -i 's|'${VHNAME}' '${MY_IP}'|'${VHNAME}' '${MY_IP}', '${DOMAIN}', '${WWW_DOMAIN}' |g' ${WEBCF} 149 | else 150 | sed -i 's|'${VHNAME}' \*|'${VHNAME}' \*, '${DOMAIN}', '${WWW_DOMAIN}' |g' ${WEBCF} 151 | fi 152 | fi 153 | restart_lsws 154 | echoG "\nDomain has been added into OpenLiteSpeed listener.\n" 155 | } 156 | 157 | domainverify(){ 158 | curl -Is http://${DOMAIN}/ | grep -i 'LiteSpeed\|cloudflare' > /dev/null 2>&1 159 | if [ ${?} = 0 ]; then 160 | echoG "[OK] ${DOMAIN} is accessible." 161 | TYPE=1 162 | curl -Is http://${WWW_DOMAIN}/ | grep -i 'LiteSpeed\|cloudflare' > /dev/null 2>&1 163 | if [ ${?} = 0 ]; then 164 | echoG "[OK] ${WWW_DOMAIN} is accessible." 165 | TYPE=2 166 | else 167 | echo "${WWW_DOMAIN} is inaccessible." 168 | fi 169 | else 170 | echo "${DOMAIN} is inaccessible, please verify!"; exit 1 171 | fi 172 | } 173 | 174 | main_domain_setup(){ 175 | domainhelp 176 | while true; do 177 | domaininput 178 | read TMP_YN 179 | if [[ "${TMP_YN}" =~ ^(y|Y) ]]; then 180 | www_domain ${DOMAIN} 181 | domainadd 182 | break 183 | fi 184 | done 185 | } 186 | emailinput(){ 187 | CKREG="^[a-z0-9!#\$%&'*+/=?^_\`{|}~-]+(\.[a-z0-9!#$%&'*+/=?^_\`{|}~-]+)*@([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]([a-z0-9-]*[a-z0-9])?\$" 188 | printf "%s" "Please enter your E-mail: " 189 | read EMAIL 190 | if [[ ${EMAIL} =~ ${CKREG} ]] ; then 191 | echo -e "The E-mail you entered is: \e[31m${EMAIL}\e[39m" 192 | printf "%s" "Please verify it is correct: [y/N] " 193 | else 194 | echo -e "\nPlease enter a valid E-mail, exit setup\n"; exit 1 195 | fi 196 | } 197 | 198 | rstlswscron(){ 199 | echo '0 0 * * 3 root systemctl restart lsws' | sudo tee -a ${BOTCRON} > /dev/null 200 | } 201 | 202 | certbothook(){ 203 | grep 'certbot.*restart lsws' ${BOTCRON} >/dev/null 2>&1 204 | if [ ${?} = 0 ]; then 205 | echoG 'Web Server Restart hook already set!' 206 | else 207 | if [ "${OSNAME}" = 'ubuntu' ] || [ "${OSNAME}" = 'debian' ] ; then 208 | sed -i 's/0.*/& --deploy-hook "systemctl restart lsws"/g' ${BOTCRON} 209 | elif [ "${OSNAME}" = 'centos' ]; then 210 | if [ "${OSVER}" = '7' ]; then 211 | echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew -q --deploy-hook 'systemctl restart lsws'" \ 212 | | sudo tee -a ${BOTCRON} > /dev/null 213 | elif [ "${OSVER}" = '8' ]; then 214 | echo "0 0,12 * * * root python3 -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot renew -q --deploy-hook 'systemctl restart lsws'" \ 215 | | sudo tee -a ${BOTCRON} > /dev/null 216 | else 217 | echoY 'Please check certbot crontab' 218 | fi 219 | fi 220 | rstlswscron 221 | grep 'restart lsws' ${BOTCRON} > /dev/null 2>&1 222 | if [ ${?} = 0 ]; then 223 | echoG 'Certbot hook update success' 224 | else 225 | echoY 'Please check certbot crond' 226 | fi 227 | fi 228 | } 229 | 230 | lecertapply(){ 231 | if [ ${TYPE} = 1 ]; then 232 | certbot certonly --non-interactive --agree-tos -m ${EMAIL} --webroot -w ${DOCHM} -d ${DOMAIN} 233 | elif [ ${TYPE} = 2 ]; then 234 | certbot certonly --non-interactive --agree-tos -m ${EMAIL} --webroot -w ${DOCHM} -d ${DOMAIN} -d ${WWW_DOMAIN} 235 | else 236 | echo 'Unknown type!'; exit 2 237 | fi 238 | if [ ${?} -eq 0 ]; then 239 | echo "vhssl { 240 | keyFile /etc/letsencrypt/live/${DOMAIN}/privkey.pem 241 | certFile /etc/letsencrypt/live/${DOMAIN}/fullchain.pem 242 | certChain 1 243 | }" >> ${LSVHCFPATH} 244 | 245 | echoG "\ncertificate has been successfully installed..." 246 | else 247 | echo "Oops, something went wrong..." 248 | exit 1 249 | fi 250 | } 251 | 252 | force_https() { 253 | if [ "${VHNAME}" != 'Example' ]; then 254 | duplicateck "RewriteCond %{HTTPS} on" "${DOCHM}/.htaccess" 255 | if [ ${?} = 1 ]; then 256 | echo "$(echo ' 257 | ### Forcing HTTPS rule start 258 | RewriteEngine On 259 | RewriteCond %{HTTPS} off 260 | RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 261 | ### Forcing HTTPS rule end 262 | ' | cat - ${DOCHM}/.htaccess)" > ${DOCHM}/.htaccess 263 | fi 264 | else 265 | sed -i '/^ logLevel 0/a\ \ rules << /dev/null 2>&1 293 | echo -ne '##### (33%)\r' 294 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' upgrade > /dev/null 2>&1 295 | echo -ne '############# (66%)\r' 296 | if [ -f /etc/apt/sources.list.d/mariadb_repo.list ]; then 297 | ### an apt bug 298 | mv /etc/apt/sources.list.d/mariadb_repo.list /tmp/ 299 | fi 300 | #DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade > /dev/null 2>&1 301 | echo -ne '#################### (99%)\r' 302 | apt-get clean > /dev/null 2>&1 303 | apt-get autoclean > /dev/null 2>&1 304 | systemctl daemon-reload > /dev/null 2>&1 305 | echo -ne '####################### (100%)\r' 306 | } 307 | 308 | yumupgrade(){ 309 | echo -ne '# (5%)\r' 310 | yum update -y > /dev/null 2>&1 311 | echo -ne '####################### (100%)\r' 312 | } 313 | main_cert_setup(){ 314 | printf "%s" "Do you wish to issue a Let's encrypt certificate for this domain? [y/N] " 315 | read TMP_YN 316 | if [[ "${TMP_YN}" =~ ^(y|Y) ]]; then 317 | domainverify 318 | while true; do 319 | emailinput 320 | read TMP_YN 321 | if [[ "${TMP_YN}" =~ ^(y|Y) ]]; then 322 | lecertapply 323 | break 324 | fi 325 | done 326 | certbothook 327 | printf "%s" "Do you wish to force HTTPS rewrite rule for this domain? [y/N] " 328 | read TMP_YN 329 | if [[ "${TMP_YN}" =~ ^(y|Y) ]]; then 330 | force_https 331 | fi 332 | restart_lsws 333 | fi 334 | } 335 | 336 | main_upgrade(){ 337 | if [ "${OSNAME}" = 'ubuntu' ]; then 338 | if [ ${PROVIDER} != 'aliyun' ]; then 339 | aptupgradelist 340 | fi 341 | else 342 | yumupgradelist 343 | fi 344 | #if [ "${UPDATE}" = 'TRUE' ]; then 345 | printf "%s" "Do you wish to update the system now? This will update the web server as well. [Y/n]? " 346 | read TMP_YN 347 | if [[ ! "${TMP_YN}" =~ ^(n|N) ]]; then 348 | echoG "Update Starting..." 349 | if [ "${OSNAME}" = 'ubuntu' ]; then 350 | aptgetupgrade 351 | else 352 | yumupgrade 353 | fi 354 | echoG "\nUpdate complete" 355 | fi 356 | #else 357 | # echoG 'Your system is up to date' 358 | #fi 359 | if [ ! -d /usr/local/CyberCP ]; then 360 | echoG "\nEnjoy your accelarated OpenLiteSpeed server!\n" 361 | else 362 | echoG "\nEnjoy your accelarated CyberPanel server!\n" 363 | fi 364 | } 365 | 366 | main(){ 367 | check_os 368 | providerck 369 | get_ip 370 | if [ ! -d /usr/local/CyberCP ]; then 371 | main_domain_setup 372 | main_cert_setup 373 | fi 374 | main_upgrade 375 | endsetup 376 | } 377 | main 378 | rm -- "$0" 379 | exit 0 380 | -------------------------------------------------------------------------------- /Setup/nodejssetup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # /******************************************************************** 3 | # LiteSpeed NodeJS setup Script 4 | # @Author: LiteSpeed Technologies, Inc. (https://www.litespeedtech.com) 5 | # @Copyright: (c) 2019-2024 6 | # @Version: 1.2 7 | # *********************************************************************/ 8 | LSWSFD='/usr/local/lsws' 9 | USER='nobody' 10 | GROUP='nogroup' 11 | FIREWALLLIST="22 80 443" 12 | LSWSCONF="${LSWSFD}/conf/httpd_config.conf" 13 | LSWSVHCONF="${LSWSFD}/conf/vhosts/Example/vhconf.conf" 14 | PROJNAME='node' 15 | VHDOCROOT='/usr/local/lsws/Example/html' 16 | DEMOPROJECT="${VHDOCROOT}/${PROJNAME}" 17 | ALLERRORS=0 18 | NODEJSV='18' 19 | NOWPATH=$(pwd) 20 | 21 | echoY(){ 22 | echo -e "\033[38;5;148m${1}\033[39m" 23 | } 24 | 25 | echoG(){ 26 | echo -e "\033[38;5;71m${1}\033[39m" 27 | } 28 | 29 | echoR(){ 30 | echo -e "\033[38;5;203m${1}\033[39m" 31 | } 32 | 33 | linechange(){ 34 | LINENUM=$(grep -n "${1}" ${2} | cut -d: -f 1) 35 | if [ -n "$LINENUM" ] && [ "$LINENUM" -eq "$LINENUM" ] 2>/dev/null; then 36 | sed -i "${LINENUM}d" ${2} 37 | sed -i "${LINENUM}i${3}" ${2} 38 | fi 39 | } 40 | 41 | check_os(){ 42 | if [ -f /etc/redhat-release ] ; then 43 | OSNAME=centos 44 | USER='nobody' 45 | GROUP='nobody' 46 | OSVER=$(cat /etc/redhat-release | awk '{print substr($4,1,1)}') 47 | elif [ -f /etc/lsb-release ] ; then 48 | OSNAME=ubuntu 49 | OSNAMEVER="UBUNTU$(lsb_release -sr | awk -F '.' '{print $1}')" 50 | elif [ -f /etc/debian_version ] ; then 51 | OSNAME=debian 52 | fi 53 | } 54 | 55 | check_provider(){ 56 | if [ -e /sys/devices/virtual/dmi/id/product_uuid ] && [[ "$(sudo cat /sys/devices/virtual/dmi/id/product_uuid | cut -c 1-3)" =~ (EC2|ec2) ]]; then 57 | PROVIDER='aws' 58 | elif [ "$(dmidecode -s bios-vendor)" = 'Google' ];then 59 | PROVIDER='google' 60 | elif [ "$(dmidecode -s bios-vendor)" = 'DigitalOcean' ];then 61 | PROVIDER='do' 62 | elif [ "$(dmidecode -s system-product-name | cut -c 1-7)" = 'Alibaba' ];then 63 | PROVIDER='aliyun' 64 | elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then 65 | PROVIDER='azure' 66 | elif [ -e /etc/oracle-cloud-agent/ ]; then 67 | PROVIDER='oracle' 68 | else 69 | PROVIDER='undefined' 70 | fi 71 | } 72 | 73 | change_owner(){ 74 | chown -R ${USER}:${GROUP} ${DEMOPROJECT} 75 | } 76 | 77 | centos_sys_upgrade(){ 78 | echoG 'Updating system' 79 | echo -ne '# (5%)\r' 80 | yum update -y > /dev/null 2>&1 81 | echo -ne '####################### (100%)\r' 82 | } 83 | 84 | ubuntu_sys_upgrade(){ 85 | echoG 'Updating system' 86 | apt-get update > /dev/null 2>&1 87 | echo -ne '##### (33%)\r' 88 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' upgrade > /dev/null 2>&1 89 | echo -ne '############# (66%)\r' 90 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade > /dev/null 2>&1 91 | echo -ne '#################### (99%)\r' 92 | apt-get clean > /dev/null 2>&1 93 | apt-get autoclean > /dev/null 2>&1 94 | echo -ne '####################### (100%)\r' 95 | } 96 | 97 | centos_install_basic(){ 98 | yum -y install wget > /dev/null 2>&1 99 | } 100 | 101 | ubuntu_install_basic(){ 102 | apt-get -y install wget ufw > /dev/null 2>&1 103 | } 104 | 105 | install_ols(){ 106 | cd /tmp/; wget -q https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh 107 | chmod +x ols1clk.sh 108 | echo 'Y' | bash ols1clk.sh 109 | } 110 | 111 | centos_install_ols(){ 112 | install_ols 113 | } 114 | 115 | ubuntu_install_ols(){ 116 | install_ols 117 | } 118 | 119 | centos_install_nodejs(){ 120 | echoG 'Install nodejs' 121 | ### Install nodejs with version 12 by using EPEL repository 122 | curl -sL https://rpm.nodesource.com/setup_${NODEJSV}.x | sudo -E bash - > /dev/null 2>&1 123 | yum install nodejs -y > /dev/null 2>&1 124 | echoG "NodeJS: $(node --version)" 125 | echoG "NPM: $(npm --version)" 126 | } 127 | 128 | ubuntu_install_nodejs(){ 129 | echoG 'Install nodejs' 130 | ### Install nodejs with version 12 by using EPEL repository 131 | curl -sL https://deb.nodesource.com/setup_${NODEJSV}.x | sudo -E bash - > /dev/null 2>&1 132 | apt-get install nodejs -y > /dev/null 2>&1 133 | echoG "NodeJS: $(node --version)" 134 | echoG "NPM: $(npm --version)" 135 | } 136 | 137 | centos_install_certbot(){ 138 | echoG "Install CertBot" 139 | if [ ${OSVER} = 8 ]; then 140 | wget -q https://dl.eff.org/certbot-auto 141 | mv certbot-auto /usr/local/bin/certbot 142 | chown root /usr/local/bin/certbot 143 | chmod 0755 /usr/local/bin/certbot 144 | echo "y" | /usr/local/bin/certbot > /dev/null 2>&1 145 | else 146 | yum -y install certbot > /dev/null 2>&1 147 | fi 148 | if [ -e /usr/bin/certbot ] || [ -e /usr/local/bin/certbot ]; then 149 | if [ ! -e /usr/bin/certbot ]; then 150 | ln -s /usr/local/bin/certbot /usr/bin/certbot 151 | fi 152 | echoG 'Install CertBot finished' 153 | else 154 | echoR 'Please check CertBot' 155 | fi 156 | } 157 | 158 | ubuntu_install_certbot(){ 159 | echoG "Install CertBot" 160 | if [ "${OSNAMEVER}" = 'UBUNTU18' ]; then 161 | add-apt-repository universe > /dev/null 2>&1 162 | echo -ne '\n' | add-apt-repository ppa:certbot/certbot > /dev/null 2>&1 163 | fi 164 | apt-get update > /dev/null 2>&1 165 | apt-get -y install certbot > /dev/null 2>&1 166 | if [ -e /usr/bin/certbot ] || [ -e /usr/local/bin/certbot ]; then 167 | if [ ! -e /usr/bin/certbot ]; then 168 | ln -s /usr/local/bin/certbot /usr/bin/certbot 169 | fi 170 | echoG 'Install CertBot finished' 171 | else 172 | echoR 'Please check CertBot' 173 | fi 174 | } 175 | 176 | restart_lsws(){ 177 | echoG 'Restart LiteSpeed Web Server' 178 | ${LSWSFD}/bin/lswsctrl stop >/dev/null 2>&1 179 | systemctl stop lsws >/dev/null 2>&1 180 | systemctl start lsws >/dev/null 2>&1 181 | } 182 | 183 | config_ols(){ 184 | echoG 'Setting Web Server config' 185 | cat > ${LSWSVHCONF} < "${DEMOPROJECT}/app.js" < { 281 | res.statusCode = 200; 282 | res.setHeader('Content-Type', 'text/plain'); 283 | res.end('Hello World! From OpenLiteSpeed NodeJS\n'); 284 | }); 285 | 286 | server.listen(port, hostname, () => { 287 | console.log(\`Server running at http://\${hostname}:\${port}/\`); 288 | }); 289 | END 290 | } 291 | 292 | centos_set_app(){ 293 | app_setup 294 | } 295 | 296 | ubuntu_set_app(){ 297 | app_setup 298 | } 299 | 300 | oci_iptables(){ 301 | if [ -e /etc/iptables/rules.v4 ]; then 302 | echoG 'Setting Firewall for OCI' 303 | sed '/^:InstanceServices/r'<( 304 | echo '-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT' 305 | echo '-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT' 306 | echo '-A INPUT -p udp -m state --state NEW -m udp --dport 443 -j ACCEPT' 307 | echo '-A INPUT -p tcp -m state --state NEW -m tcp --dport 7080 -j ACCEPT' 308 | ) -i -- /etc/iptables/rules.v4 309 | fi 310 | } 311 | 312 | centos_install_firewall(){ 313 | echoG 'Install Firewall' 314 | if [ ! -e /usr/sbin/firewalld ]; then 315 | yum -y install firewalld > /dev/null 2>&1 316 | fi 317 | service firewalld start > /dev/null 2>&1 318 | systemctl enable firewalld > /dev/null 2>&1 319 | } 320 | 321 | centos_config_firewall(){ 322 | echoG 'Setting Firewall' 323 | for PORT in ${FIREWALLLIST}; do 324 | firewall-cmd --permanent --add-port=${PORT}/tcp > /dev/null 2>&1 325 | done 326 | firewall-cmd --reload > /dev/null 2>&1 327 | firewall-cmd --list-all | grep 80 > /dev/null 2>&1 328 | if [ ${?} = 0 ]; then 329 | echoG 'firewalld rules setup success' 330 | else 331 | echoR 'Please check firewalld rules' 332 | fi 333 | } 334 | 335 | ubuntu_config_firewall(){ 336 | echoG 'Setting Firewall' 337 | #ufw status verbose | grep inactive > /dev/null 2>&1 338 | #if [ ${?} = 0 ]; then 339 | for PORT in ${FIREWALLLIST}; do 340 | ufw allow ${PORT} > /dev/null 2>&1 341 | done 342 | echo "y" | ufw enable > /dev/null 2>&1 343 | 344 | ufw status | grep '80.*ALLOW' > /dev/null 2>&1 345 | if [ ${?} = 0 ]; then 346 | echoG 'firewalld rules setup success' 347 | else 348 | echoR 'Please check ufw rules' 349 | fi 350 | #else 351 | # echoG "ufw already enabled" 352 | #fi 353 | } 354 | 355 | rm_dummy(){ 356 | echoG 'Remove dummy file' 357 | rm -f "${NOWPATH}/example.csr" "${NOWPATH}/privkey.pem" 358 | echoG 'Finished dummy file' 359 | } 360 | 361 | init_check(){ 362 | START_TIME="$(date -u +%s)" 363 | check_os 364 | check_provider 365 | } 366 | 367 | centos_main_install(){ 368 | centos_install_basic 369 | centos_install_ols 370 | centos_install_nodejs 371 | centos_install_certbot 372 | centos_install_firewall 373 | } 374 | 375 | centos_main_config(){ 376 | centos_set_app 377 | centos_set_ols 378 | centos_config_firewall 379 | } 380 | 381 | ubuntu_main_install(){ 382 | ubuntu_install_basic 383 | ubuntu_install_ols 384 | ubuntu_install_nodejs 385 | ubuntu_install_certbot 386 | } 387 | 388 | ubuntu_main_config(){ 389 | ubuntu_set_app 390 | ubuntu_set_ols 391 | ubuntu_config_firewall 392 | } 393 | 394 | end_message(){ 395 | rm_dummy 396 | END_TIME="$(date -u +%s)" 397 | ELAPSED="$((${END_TIME}-${START_TIME}))" 398 | echoY "***Total of ${ELAPSED} seconds to finish process***" 399 | } 400 | 401 | main(){ 402 | init_check 403 | if [ ${OSNAME} = 'centos' ]; then 404 | centos_sys_upgrade 405 | centos_main_install 406 | centos_main_config 407 | else 408 | ubuntu_sys_upgrade 409 | ubuntu_main_install 410 | ubuntu_main_config 411 | fi 412 | acme_folder 413 | restart_lsws 414 | change_owner 415 | end_message 416 | } 417 | 418 | main 419 | #rm -- "$0" 420 | exit 0 -------------------------------------------------------------------------------- /Setup/ols2ent-v2.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # /******************************************************************** 3 | # OpenLiteSpeed to Enterprise setup Script 4 | # @Author: LiteSpeed Technologies, Inc. (https://www.litespeedtech.com) 5 | # @Version: 2.1 6 | # *********************************************************************/ 7 | TOTAL_RAM=$(free -m | awk '/Mem:/ { print $2 }') 8 | LICENSE_KEY="" 9 | PHP='php' 10 | ADMIN_PASS='12345678' 11 | PANEL='' 12 | LS_DIR='/usr/local/lsws' 13 | STORE_DIR='/opt/.litespeed_conf' 14 | ols_conf_file="${LS_DIR}/conf/httpd_config.conf" 15 | CONVERT_LOG='/opt/convert.log' 16 | declare -a vhosts 17 | declare -a domains 18 | EPACE=' ' 19 | start_mark='{' 20 | end_mark='}' 21 | 22 | echow(){ 23 | FLAG=${1} 24 | shift 25 | echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}" 26 | } 27 | echoG() { 28 | echo -e "\033[38;5;71m${1}\033[39m" 29 | } 30 | echoR() 31 | { 32 | echo -e "\033[38;5;203m${1}\033[39m" 33 | } 34 | 35 | show_help() { 36 | echo -e "\nOpenLiteSpeed to LiteSpeed Enterprise converter script." 37 | echo -e "\nThis script will:" 38 | echo -e "1. Generate LSWS config file from OpenLiteSpeed." 39 | echo -e "2. Ask you to input valid license key or Trial." 40 | echo -e "3. Backup current ${LS_DIR}/conf directory to ${STORE_DIR} and uninstall OpenLiteSpeed" 41 | echo -e "4. Install LiteSpeed Enterprise and use the configuration file from step 1\n" 42 | echo -e "\033[1m[Options]\033[0m" 43 | echow '-L, --lsws' 44 | echo "${EPACE}${EPACE} Install and switch from OLS to LSWS. " 45 | echow '-R, --restore' 46 | echo "${EPACE}${EPACE} Restore to OpenLiteSpeed. " 47 | echow '-H, --help' 48 | echo "${EPACE}${EPACE}Display help and exit." 49 | exit 0 50 | } 51 | 52 | webadmin_reset() { 53 | echoG 'Set webadmin password.' 54 | if [[ -f ${LS_DIR}/admin/fcgi-bin/admin_php ]] ; then 55 | php_command="admin_php" 56 | else 57 | php_command="admin_php5" 58 | fi 59 | if [ -e /root/.litespeed_password ]; then 60 | WEBADMIN_PASS=$(awk -F '=' '{print $2}' /root/.litespeed_password) 61 | elif [ -e /home/ubuntu/.litespeed_password ]; then 62 | WEBADMIN_PASS=$(awk -F '=' '{print $2}' /home/ubuntu/.litespeed_password) 63 | else 64 | WEBADMIN_PASS=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 ; echo '') 65 | fi 66 | TEMP=`${LS_DIR}/admin/fcgi-bin/${php_command} ${LS_DIR}/admin/misc/htpasswd.php ${WEBADMIN_PASS}` 67 | echo "" > ${LS_DIR}/admin/conf/htpasswd 68 | echo "admin:$TEMP" > ${LS_DIR}/admin/conf/htpasswd 69 | echoG "WebAdmin Console password has been set to: ${WEBADMIN_PASS}" 70 | } 71 | 72 | check_no_panel(){ 73 | if [ -d /usr/local/CyberCP ]; then 74 | PANEL='cyberpanel' 75 | elif [ -d /usr/local/cpanel ]; then 76 | PANEL='cpanel' 77 | elif [ -d /usr/local/plesk ]; then 78 | PANEL='plesk' 79 | elif [ -d /usr/local/directadmin ]; then 80 | PANEL='directadmin' 81 | fi 82 | if [ ! -z "${PANEL}" ]; then 83 | echoR "Detect control panel: ${PANEL}, exit!"; exit 1 84 | fi 85 | } 86 | 87 | 88 | check_pkg_manage(){ 89 | if hash apt > /dev/null 2>&1 ; then 90 | PKG_TOOL='apt' 91 | USER="www-data" 92 | GROUP="www-data" 93 | elif hash yum > /dev/null 2>&1 ; then 94 | PKG_TOOL='yum' 95 | USER="nobody" 96 | GROUP="nobody" 97 | else 98 | echoR 'can not detect package management tool ...' 99 | exit 1 100 | fi 101 | } 102 | 103 | check_php(){ 104 | if [ -e ${LS_DIR}/lsphp73/bin/php ]; then 105 | PHP="${LS_DIR}/lsphp73/bin/php" 106 | elif [ -e ${LS_DIR}/lsphp74/bin/php ]; then 107 | PHP="${LS_DIR}/lsphp74/bin/php" 108 | elif [ -e ${LS_DIR}/lsphp81/bin/php ]; then 109 | PHP="${LS_DIR}/lsphp81/bin/php" 110 | fi 111 | which ${PHP} >/dev/null 112 | if [ ${?} = 0 ]; then 113 | echoG 'PHP path exist' 114 | else 115 | ls ${LS_DIR}/lsphp* >/dev/null 116 | if [ ${?} = 0 ]; then 117 | echoG 'PHP path update' 118 | PHP=$(find ${LS_DIR}/lsphp* -path \*bin/php | head -n 1) 119 | fi 120 | which ${PHP} >/dev/null 121 | if [ ${?} != 0 ]; then 122 | echoR 'PHP path does not exist, exit!'; exit 1 123 | fi 124 | fi 125 | } 126 | 127 | add_converter_script(){ 128 | cat << EOM > ${LS_DIR}/admin/misc/converter.php 129 | ${CONVERT_LOG} 154 | if [ ${?} != 0 ]; then 155 | echo "Convert config file failed, error code: ${?}" 156 | echoR "#############################################" 157 | cat ${CONVERT_LOG} 158 | echoR "#############################################" 159 | exit 1 160 | fi 161 | CONVERTFOLD=($(awk '/converted/ {print $2}' ${CONVERT_LOG} | awk -F '/' 'NF-=1' OFS="/")) 162 | CONVERTPATH=($(awk '/converted/ {print $2}' ${CONVERT_LOG})) 163 | CONVERTFILE=($(awk '/converted/ {print $2}' ${CONVERT_LOG} | awk -F '/' '{print $NF}')) 164 | 165 | for FOLDER in "${CONVERTFOLD[@]}"; do 166 | VNAME=$(echo ${FOLDER} | awk -F '/' '$6 == "vhosts" {print $7}') 167 | if [ ! -z "${VNAME}" ]; then 168 | mkdir -p ${STORE_DIR}/ent_conf/vhosts/"${VNAME}" 169 | fi 170 | done 171 | for FILE in "${CONVERTPATH[@]}"; do 172 | VFILE=$(echo ${FILE} | awk -F '/' '$6 == "vhosts" {print $7}') 173 | if [ ! -z "${VFILE}" ]; then 174 | cp "${FILE}" ${STORE_DIR}/ent_conf/vhosts/"${VFILE}"/ 175 | else 176 | cp "${FILE}" ${STORE_DIR}/ent_conf/ 177 | fi 178 | done 179 | } 180 | 181 | set_ent_cache(){ 182 | grep '' ${LS_DIR}/conf/httpd_config.xml >/dev/null 183 | if [ ${?} = 0 ]; then 184 | echoG 'Detect cache, skip!' 185 | else 186 | echoG 'Enable Cache' 187 | sed -i '/<\/scriptHandlerList>/a\ 188 | \ 189 | 7 \ 190 | \ 191 | /home/lscache \ 192 | \ 193 | 194 | ' ${LS_DIR}/conf/httpd_config.xml 195 | fi 196 | } 197 | 198 | set_ent_htaccess(){ 199 | grep '' ${LS_DIR}/conf/httpd_config.xml >/dev/null 200 | if [ ${?} = 0 ]; then 201 | echoG 'Detect htaccess, skip!' 202 | else 203 | echoG 'Enable htaccess' 204 | sed -i '/<\/logging>/a\ 205 | \ 206 | 31 \ 207 | 208 | ' ${LS_DIR}/conf/httpd_config.xml 209 | fi 210 | } 211 | 212 | restore_ols() { 213 | if ${LS_DIR}/bin/lshttpd -v | grep -q Open ; then 214 | echoG 'You already have OpenLiteSpeed installed...' 215 | exit 0 216 | fi 217 | echo -e "Listing all the backup files: \n" 218 | ls ${STORE_DIR} | grep OLS_ --color=never 219 | printf "%s" "Please input the backup directory: " 220 | read ols_backup_dir 221 | 222 | if [[ ! -d ${STORE_DIR}/${ols_backup_dir} ]] ; then 223 | echoR 'The dir seems not exists.' 224 | exit 1 225 | fi 226 | if [[ ! -f ${STORE_DIR}/${ols_backup_dir}/conf/httpd_config.conf ]] ; then 227 | echoR 'Main conf file is missing...' 228 | exit 1 229 | else 230 | ${PKG_TOOL} install openlitespeed -y >/dev/null 2>&1 231 | rm -rf ${LS_DIR}/conf/* 232 | cp -a ${STORE_DIR}/${ols_backup_dir}/conf/* ${LS_DIR}/conf/ 233 | chown -R lsadm:lsadm ${LS_DIR}/conf 234 | chown root:root ${LS_DIR}/logs 235 | chmod 755 ${LS_DIR}/logs 236 | restart_lsws 237 | rm -f ${LS_DIR}/autoupdate/* 238 | echoG 'OpenLiteSpeed Restored...' 239 | webadmin_reset 240 | fi 241 | } 242 | 243 | download_lsws() { 244 | echoG 'Download LiteSpeed Web Server.' 245 | LATEST_VERSION=$(curl -s -S http://update.litespeedtech.com/ws/latest.php | head -n 1 | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p') 246 | MAJOR_VERSION=$(echo "${LATEST_VERSION}" | cut -c 1) 247 | BITNESS=$(uname -m) 248 | if [ "${BITNESS}" == "i686" ]; then 249 | BITNESS="i386" 250 | fi 251 | rm -f lsws-latest.tar.gz; rm -rf "lsws-${LATEST_VERSION}" 252 | cd /opt; curl -s -S -o "lsws-latest.tar.gz" https://www.litespeedtech.com/packages/"${MAJOR_VERSION}".0/lsws-"${LATEST_VERSION}"-ent-"${BITNESS}"-linux.tar.gz 253 | check_return 254 | tar -xzf "lsws-latest.tar.gz"; cd "lsws-${LATEST_VERSION}" 255 | } 256 | 257 | write_license() { 258 | if [[ ${LICENSE_KEY} == 'TRIAL' ]] ; then 259 | wget -q http://license.litespeedtech.com/reseller/trial.key 260 | check_return 261 | if ./lshttpd -V |& grep "ERROR" ; then 262 | ./lshttpd -V 263 | echoR 'It apeears to have some issue with license , please check above result...' 264 | exit 1 265 | fi 266 | echoG 'License seems valid...' 267 | else 268 | echo ${LICENSE_KEY} > serial.no 269 | if ./lshttpd -r |& grep "ERROR" ; then 270 | ./lshttpd -r 271 | echoR 'It apeears to have some issue with license , please check above result...' 272 | exit 1 273 | fi 274 | echoG 'License seems valid...' 275 | fi 276 | } 277 | 278 | check_license(){ 279 | KEY_SIZE=${#1} 280 | TMP=$(echo ${1} | cut -c5) 281 | TMP2=$(echo ${1} | cut -c10) 282 | TMP3=$(echo ${1} | cut -c15) 283 | if [[ ${TMP} == "-" ]] && [[ ${TMP2} == "-" ]] && [[ ${TMP3} == "-" ]] && [[ ${KEY_SIZE} == "19" ]] ; then 284 | echoG 'License key format check...' 285 | elif [[ ${1} == "trial" ]] || [[ ${1} == "TRIAL" ]] || [[ ${1} == "Trial" ]] ; then 286 | echoG 'Trial license format check...' 287 | LICENSE_KEY='TRIAL' 288 | else 289 | echoR 'License key seems incorrect, please verify' 290 | exit 1 291 | fi 292 | } 293 | 294 | license_input() { 295 | echo -e "\nPlease note that your server has \e[31m$TOTAL_RAM MB\e[39m RAM" 296 | if [ "$TOTAL_RAM" -gt 2048 ]; then 297 | echo "$TOTAL_RAM is greater than 2048 MB RAM" 298 | echo -e "If you are using \e[31mFree Starter\e[39m LiteSpeed license, It will not start due to 2GB RAM limit." 299 | fi 300 | 301 | echo -e "If you do not have any license, you can also use trial license (if server has not used trial license before), type \e[31mTRIAL\e[39m\n" 302 | while true; do 303 | printf "%s" "Please input your serial number for LiteSpeed WebServer Enterprise: " 304 | read LICENSE_KEY 305 | if [ -z "${LICENSE_KEY}" ] ; then 306 | echo -e "\nPlease provide license key\n" 307 | else 308 | echo -e "The serial number you input is: \e[31m${LICENSE_KEY}\e[39m" 309 | printf "%s" "Please verify it is correct. [y/N]: " 310 | read TMP_YN 311 | if [[ "${TMP_YN}" =~ ^(y|Y) ]]; then 312 | break 313 | fi 314 | fi 315 | done 316 | check_license "${LICENSE_KEY}" 317 | write_license 318 | } 319 | 320 | restart_lsws(){ 321 | ${LS_DIR}/bin/lswsctrl stop > /dev/null 2>&1 322 | pkill lsphp 323 | systemctl stop lsws 324 | systemctl start lsws 325 | systemctl status lsws 326 | if [[ ${?} == '0' ]] ; then 327 | echo -e "\nLiteSpeed has started and running...\n" 328 | else 329 | echo -e "Something went wrong , LSWS can not be started." 330 | exit 1 331 | fi 332 | } 333 | 334 | check_return() { 335 | if [[ ${?} -eq "0" ]] ; then 336 | : 337 | else 338 | echoR 'Command failed, exiting...' 339 | exit 1 340 | fi 341 | } 342 | 343 | gen_store_dir(){ 344 | if [[ ! -d ${STORE_DIR} ]] ; then 345 | mkdir ${STORE_DIR} 346 | fi 347 | if [[ ! -d ${STORE_DIR}/conf ]] ; then 348 | mkdir ${STORE_DIR}/conf 349 | else 350 | rm -rf ${STORE_DIR}/conf/* 351 | fi 352 | } 353 | 354 | uninstall_ols() { 355 | echoG 'Uninstall OpenLiteSpeed.' 356 | if [[ -f ${LS_DIR}/conf/httpd_config.conf ]] ; then 357 | DATE=`date +%Y-%m-%d_%H%M` 358 | mkdir ${STORE_DIR}/OLS_backup_$DATE/ 359 | echoG "Backing up current OpenLiteSpeed configuration file to ${STORE_DIR}/OLS_backup_${DATE}/" 360 | cp -a ${LS_DIR}/conf/ ${STORE_DIR}/OLS_backup_${DATE}/ 361 | ${LS_DIR}/bin/lswsctrl stop > /dev/null 2>&1 362 | pkill lsphp 363 | systemctl stop lsws 364 | ${PKG_TOOL} remove openlitespeed -y > /dev/null 2>&1 365 | check_return 366 | echoG 'OpenLiteSpeed successfully removed...' 367 | fi 368 | } 369 | 370 | rm_lsws_autoupdate(){ 371 | rm -f ${LS_DIR}/autoupdate/* 372 | } 373 | 374 | install_lsws() { 375 | echoG 'Installing LiteSpeed Enterprise...' 376 | sed -i '/^license$/d' install.sh 377 | sed -i 's/read TMPS/TMPS=0/g' install.sh 378 | sed -i 's/read TMP_YN/TMP_YN=N/g' install.sh 379 | sed -i 's/read TMP_URC/TMP_URC=N/g' install.sh 380 | sed -i '/read [A-Z]/d' functions.sh 381 | sed -i 's/HTTP_PORT=$TMP_PORT/HTTP_PORT=443/g' functions.sh 382 | sed -i 's/ADMIN_PORT=$TMP_PORT/ADMIN_PORT=7080/g' functions.sh 383 | sed -i "/^license()/i\ 384 | PASS_ONE=${ADMIN_PASS}\ 385 | PASS_TWO=${ADMIN_PASS}\ 386 | TMP_USER=${USER}\ 387 | TMP_GROUP=${GROUP}\ 388 | TMP_PORT=''\ 389 | TMP_DEST=''\ 390 | ADMIN_USER=''\ 391 | ADMIN_EMAIL='' 392 | " functions.sh 393 | COUNTER=0 394 | ./install.sh >/dev/null 2>&1 395 | if [[ ${?} != "0" ]] ; then 396 | while [ ${COUNTER} -le 4 ]; do 397 | ./install.sh 398 | if [[ ${?} == "0" ]] ; then 399 | break 400 | elif [[ ${COUNTER} == "3" ]]; then 401 | echoR 'Unable to install LiteSpeed Enterprise, switching back to OpenLiteSpeed...' 402 | restore_ols 403 | exit 1 404 | fi 405 | COUNTER=$((var+1)) 406 | done 407 | fi 408 | echoG 'LiteSpeed Enterprise installed...' 409 | set_ent_cache 410 | set_ent_htaccess 411 | rm_lsws_autoupdate 412 | restart_lsws 413 | } 414 | 415 | check_root_user(){ 416 | if [[ $(id -u) != 0 ]] > /dev/null; then 417 | echoR 'You must have root privileges to run this script. ...' 418 | exit 1 419 | fi 420 | } 421 | 422 | check_no_lsws(){ 423 | if ${LS_DIR}/bin/lshttpd -v | grep -q Enterprise ; then 424 | echoG 'You have already installed LiteSpeed Enterprise...' 425 | exit 1 426 | fi 427 | } 428 | 429 | main_pre_check(){ 430 | check_root_user 431 | check_no_panel 432 | check_no_lsws 433 | check_pkg_manage 434 | check_php 435 | } 436 | 437 | main_pre_gen(){ 438 | gen_store_dir 439 | add_converter_script 440 | } 441 | 442 | main_restore_ols(){ 443 | check_root_user 444 | check_pkg_manage 445 | gen_store_dir 446 | restore_ols 447 | } 448 | 449 | main_to_lsws(){ 450 | main_pre_check 451 | main_pre_gen 452 | gen_ent_config 453 | download_lsws 454 | license_input 455 | uninstall_ols 456 | install_lsws 457 | webadmin_reset 458 | } 459 | 460 | case ${1} in 461 | -[hH] | -help | --help) 462 | show_help 463 | ;; 464 | -[rR] | -restore | --restore) 465 | main_restore_ols; exit 0 466 | ;; 467 | -[lL] | -lsws | --lsws) 468 | main_to_lsws; exit 0 469 | ;; 470 | *) 471 | main_to_lsws; exit 0 472 | ;; 473 | esac 474 | -------------------------------------------------------------------------------- /Setup/railssetup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # /******************************************************************** 3 | # LiteSpeed Rails setup Script 4 | # @Author: LiteSpeed Technologies, Inc. (https://www.litespeedtech.com) 5 | # @Version: 1.3.1 6 | # *********************************************************************/ 7 | LSWSFD='/usr/local/lsws' 8 | PHPVER=74 9 | USER='nobody' 10 | GROUP='nogroup' 11 | FIREWALLLIST="22 80 443" 12 | LSWSCONF="${LSWSFD}/conf/httpd_config.conf" 13 | LSWSVHCONF="${LSWSFD}/conf/vhosts/Example/vhconf.conf" 14 | PROJNAME='demo' 15 | VHDOCROOT='/usr/local/lsws/Example/html' 16 | DEMOPROJECT="${VHDOCROOT}/${PROJNAME}" 17 | CLONE_PATH='/opt' 18 | ALLERRORS=0 19 | RUBYV='3.0.7' 20 | NODEJSV='16' 21 | NOWPATH=$(pwd) 22 | RUBY_PATH='/usr/bin/ruby' 23 | RBENV_PATH='/usr/bin/rbenv' 24 | 25 | echoY(){ 26 | echo -e "\033[38;5;148m${1}\033[39m" 27 | } 28 | 29 | echoG(){ 30 | echo -e "\033[38;5;71m${1}\033[39m" 31 | } 32 | 33 | echoR(){ 34 | echo -e "\033[38;5;203m${1}\033[39m" 35 | } 36 | 37 | linechange(){ 38 | LINENUM=$(grep -n "${1}" ${2} | cut -d: -f 1) 39 | if [ -n "$LINENUM" ] && [ "$LINENUM" -eq "$LINENUM" ] 2>/dev/null; then 40 | sed -i "${LINENUM}d" ${2} 41 | sed -i "${LINENUM}i${3}" ${2} 42 | fi 43 | } 44 | 45 | check_os(){ 46 | if [ -f /etc/redhat-release ] ; then 47 | OSNAME=centos 48 | USER='nobody' 49 | GROUP='nobody' 50 | OSVER=$(cat /etc/redhat-release | awk '{print substr($4,1,1)}') 51 | elif [ -f /etc/lsb-release ] ; then 52 | OSNAME=ubuntu 53 | OSNAMEVER="UBUNTU$(lsb_release -sr | awk -F '.' '{print $1}')" 54 | elif [ -f /etc/debian_version ] ; then 55 | OSNAME=debian 56 | fi 57 | } 58 | 59 | check_provider(){ 60 | if [ -e /sys/devices/virtual/dmi/id/product_uuid ] && [[ "$(sudo cat /sys/devices/virtual/dmi/id/product_uuid | cut -c 1-3)" =~ (EC2|ec2) ]]; then 61 | PROVIDER='aws' 62 | elif [ "$(dmidecode -s bios-vendor)" = 'Google' ];then 63 | PROVIDER='google' 64 | elif [ "$(dmidecode -s bios-vendor)" = 'DigitalOcean' ];then 65 | PROVIDER='do' 66 | elif [ "$(dmidecode -s system-product-name | cut -c 1-7)" = 'Alibaba' ];then 67 | PROVIDER='aliyun' 68 | elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then 69 | PROVIDER='azure' 70 | elif [ -e /etc/oracle-cloud-agent/ ]; then 71 | PROVIDER='oracle' 72 | else 73 | PROVIDER='undefined' 74 | fi 75 | } 76 | 77 | change_owner(){ 78 | chown -R ${USER}:${GROUP} ${DEMOPROJECT} 79 | } 80 | 81 | centos_sys_upgrade(){ 82 | echoG 'Updating system' 83 | echo -ne '# (5%)\r' 84 | yum update -y > /dev/null 2>&1 85 | echo -e '####################### (100%)\r' 86 | } 87 | 88 | ubuntu_sys_upgrade(){ 89 | echoG 'Updating system' 90 | apt-get update > /dev/null 2>&1 91 | echo -ne '##### (33%)\r' 92 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' upgrade > /dev/null 2>&1 93 | echo -ne '############# (66%)\r' 94 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade > /dev/null 2>&1 95 | echo -ne '#################### (99%)\r' 96 | apt-get clean > /dev/null 2>&1 97 | apt-get autoclean > /dev/null 2>&1 98 | echo -e '####################### (100%)\r' 99 | } 100 | 101 | output_msg(){ 102 | if [ ${1} = 0 ]; then 103 | echoG "[O] ${2} install" 104 | else 105 | echoR "[X] ${2} install, abort!" 106 | exit 1 107 | fi 108 | } 109 | 110 | symlink(){ 111 | if [ -e "${1}" ]; then 112 | if [ -e "${2}" ]; then 113 | echoG "Backup ${2}" 114 | mv "${2}" "${2}.bk" 115 | fi 116 | ln -s "${1}" "${2}" 117 | chmod 777 ${2} 118 | else 119 | echoR "${1} does not exist, skip!" 120 | fi 121 | } 122 | 123 | centos_install_basic(){ 124 | yum -y install wget > /dev/null 2>&1 125 | yum -y install git > /dev/null 2>&1 126 | yum -y install git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel\ 127 | libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel > /dev/null 2>&1 128 | } 129 | 130 | ubuntu_install_basic(){ 131 | apt-get -y install wget ufw> /dev/null 2>&1 132 | apt-get -y install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev \ 133 | zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev libsqlite3-dev > /dev/null 2>&1 134 | if [ "${OSNAMEVER}" = 'UBUNTU18' ]; then 135 | apt-get -y install libgdbm5 > /dev/null 2>&1 136 | else 137 | apt-get -y install libgdbm6 > /dev/null 2>&1 138 | fi 139 | } 140 | 141 | install_ols(){ 142 | echoG '[Start] Install OpenLiteSpeed' 143 | cd /tmp/; wget -q https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh 144 | chmod +x ols1clk.sh 145 | echo 'Y' | bash ols1clk.sh --lsphp ${PHPVER} >/dev/null 2>&1 146 | echoG '[End] Install OpenLiteSpeed' 147 | } 148 | 149 | centos_install_ols(){ 150 | install_ols 151 | } 152 | 153 | ubuntu_install_ols(){ 154 | install_ols 155 | } 156 | 157 | centos_install_nodejs(){ 158 | echoG 'Install nodejs' 159 | ### Install nodejs by using EPEL repository 160 | curl -sL https://rpm.nodesource.com/setup_${NODEJSV}.x | sudo -E bash - > /dev/null 2>&1 161 | yum clean all > /dev/null 2>&1 162 | yum install nodejs -y > /dev/null 2>&1 163 | NODE_V="$(node --version)" 164 | NPM_V="$(npm --version)" 165 | } 166 | 167 | ubuntu_install_nodejs(){ 168 | echoG 'Install nodejs' 169 | ### Install nodejs by using EPEL repository 170 | curl -sL https://deb.nodesource.com/setup_${NODEJSV}.x | sudo -E bash - > /dev/null 2>&1 171 | apt-get install nodejs -y > /dev/null 2>&1 172 | NODE_V="$(node --version)" 173 | NPM_V="$(npm --version)" 174 | } 175 | 176 | install_rbenv(){ 177 | echoG 'Install rbenv' 178 | git clone --quiet https://github.com/rbenv/rbenv.git ${CLONE_PATH}/.rbenv 179 | git clone --quiet https://github.com/rbenv/ruby-build.git ${CLONE_PATH}/.rbenv/plugins/ruby-build 180 | echo "export PATH=\"${CLONE_PATH}/.rbenv/bin:$PATH\"" >> ~/.bashrc 181 | echo "export PATH=\"${CLONE_PATH}/.rbenv/plugins/ruby-build/bin:$PATH\"" >> ~/.bashrc 182 | export PATH="${CLONE_PATH}/.rbenv/bin:$PATH" 183 | export PATH="${CLONE_PATH}/.rbenv/plugins/ruby-build/bin:$PATH" 184 | eval "$(rbenv init -)" 185 | echo "RBENV_ROOT=${CLONE_PATH}/.rbenv" >> ~/.bashrc 186 | export RBENV_ROOT=${CLONE_PATH}/.rbenv 187 | symlink "${CLONE_PATH}/.rbenv/libexec/rbenv" "${RBENV_PATH}" 188 | RBEN_V="$(rbenv -v)" 189 | output_msg "${?}" 'rbenv' 190 | } 191 | 192 | install_ruby(){ 193 | echoG 'Install ruby' 194 | rbenv install ${RUBYV} > /dev/null 2>&1 195 | rbenv global ${RUBYV} > /dev/null 2>&1 196 | symlink "${CLONE_PATH}/.rbenv/versions/${RUBYV}/bin/ruby" "${RUBY_PATH}" 197 | RUBY_V="$(ruby -v)" 198 | output_msg "${?}" 'ruby' 199 | } 200 | 201 | install_gem(){ 202 | echoG 'Install gem' 203 | symlink "${CLONE_PATH}/.rbenv/versions/${RUBYV}/bin/gem" '/usr/bin/gem' 204 | gem update --system > /dev/null 2>&1 205 | GEM_V="$(gem -v)" 206 | output_msg "${?}" 'gem' 207 | } 208 | 209 | install_bundle(){ 210 | echoG 'Install bundle' 211 | symlink "${CLONE_PATH}/.rbenv/versions/${RUBYV}/bin/bundle" '/usr/bin/bundle' 212 | } 213 | 214 | install_bundler(){ 215 | echoG 'Install bundler' 216 | gem install bundler --no-document > /dev/null 2>&1 217 | symlink "${CLONE_PATH}/.rbenv/versions/${RUBYV}/bin/bundler" '/usr/bin/bundler' 218 | BUNDLER_V=$(bundler -v) 219 | output_msg "${?}" 'bundler' 220 | } 221 | 222 | install_spring(){ 223 | echoG 'Install spring' 224 | symlink "${CLONE_PATH}/.rbenv/versions/${RUBYV}/bin/spring" '/usr/bin/spring' 225 | } 226 | 227 | install_lsapi(){ 228 | echoG '[Start] Install LSAPI' 229 | gem install rack --no-document >/dev/null 2>&1 230 | gem install ruby-lsapi --no-document >/dev/null 2>&1 231 | echoG '[End] Install LSAPI' 232 | } 233 | 234 | install_rails(){ 235 | echoG 'Install rails' 236 | gem install rails >/dev/null 2>&1 237 | symlink "${CLONE_PATH}/.rbenv/versions/${RUBYV}/bin/rails" '/usr/bin/rails' 238 | RAILS_V="$(rails -v)" 239 | output_msg "${?}" 'rails' 240 | } 241 | 242 | centos_install_rbenv(){ 243 | install_rbenv 244 | } 245 | 246 | centos_install_ruby(){ 247 | install_ruby 248 | } 249 | 250 | centos_install_gem(){ 251 | install_gem 252 | } 253 | 254 | centos_install_bundler(){ 255 | install_bundler 256 | } 257 | 258 | centos_install_bundle(){ 259 | install_bundle 260 | } 261 | 262 | centos_install_spring(){ 263 | install_spring 264 | } 265 | 266 | centos_install_lsapi(){ 267 | install_lsapi 268 | } 269 | 270 | centos_install_rails(){ 271 | install_rails 272 | } 273 | 274 | ubuntu_install_rbenv(){ 275 | install_rbenv 276 | } 277 | 278 | ubuntu_install_ruby(){ 279 | install_ruby 280 | } 281 | 282 | ubuntu_install_gem(){ 283 | install_gem 284 | } 285 | 286 | ubuntu_install_bundler(){ 287 | install_bundler 288 | } 289 | 290 | ubuntu_install_bundle(){ 291 | install_bundle 292 | } 293 | 294 | ubuntu_install_spring(){ 295 | install_spring 296 | } 297 | 298 | ubuntu_install_lsapi(){ 299 | install_lsapi 300 | } 301 | 302 | ubuntu_install_rails(){ 303 | install_rails 304 | } 305 | 306 | centos_install_certbot(){ 307 | echoG "[Start] Install CertBot" 308 | if [ ${OSVER} = 8 ]; then 309 | wget -q https://dl.eff.org/certbot-auto 310 | mv certbot-auto /usr/local/bin/certbot 311 | chown root /usr/local/bin/certbot 312 | chmod 0755 /usr/local/bin/certbot 313 | echo "y" | /usr/local/bin/certbot > /dev/null 2>&1 314 | else 315 | yum -y install certbot > /dev/null 2>&1 316 | fi 317 | if [ -e /usr/bin/certbot ]; then 318 | echoG '[End] Install CertBot' 319 | else 320 | echoR 'Please check CertBot' 321 | fi 322 | } 323 | 324 | ubuntu_install_certbot(){ 325 | echoG "Install CertBot" 326 | if [ "${OSNAMEVER}" = 'UBUNTU18' ]; then 327 | add-apt-repository universe > /dev/null 2>&1 328 | echo -ne '\n' | add-apt-repository ppa:certbot/certbot > /dev/null 2>&1 329 | fi 330 | apt-get update > /dev/null 2>&1 331 | apt-get -y install certbot > /dev/null 2>&1 332 | if [ -e /usr/bin/certbot ] || [ -e /usr/local/bin/certbot ]; then 333 | if [ ! -e /usr/bin/certbot ]; then 334 | ln -s /usr/local/bin/certbot /usr/bin/certbot 335 | fi 336 | echoG 'Install CertBot finished' 337 | else 338 | echoR 'Please check CertBot' 339 | fi 340 | } 341 | 342 | restart_lsws(){ 343 | echoG 'Restart LiteSpeed Web Server' 344 | ${LSWSFD}/bin/lswsctrl stop >/dev/null 2>&1 345 | systemctl stop lsws >/dev/null 2>&1 346 | systemctl start lsws >/dev/null 2>&1 347 | } 348 | 349 | config_ols(){ 350 | echoG 'Setting Web Server config' 351 | cat > ${LSWSVHCONF} </dev/null 2>&1 445 | if [ ${?} = 0 ]; then 446 | echoG "${PROJNAME} project create success!" 447 | else 448 | echoR 'Something went wrong, please check!' 449 | fi 450 | echoG 'Generate Welcome' 451 | cd ${PROJNAME}; rails generate controller Welcome index >/dev/null 2>&1 452 | sleep 3 453 | grep welcome config/routes.rb >/dev/null 2>&1 454 | if [ ${?} = 0 ]; then 455 | NEWKEY=' get "/", to: "welcome#index"' 456 | linechange '/index' config/routes.rb "${NEWKEY}" 457 | else 458 | echoR 'Welcome not exist! Skip setting' 459 | fi 460 | echoG '[End] Install app' 461 | } 462 | 463 | centos_set_app(){ 464 | app_setup 465 | } 466 | 467 | ubuntu_set_app(){ 468 | app_setup 469 | } 470 | 471 | oci_iptables(){ 472 | if [ -e /etc/iptables/rules.v4 ]; then 473 | echoG 'Setting Firewall for OCI' 474 | sed '/^:InstanceServices/r'<( 475 | echo '-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT' 476 | echo '-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT' 477 | echo '-A INPUT -p udp -m state --state NEW -m udp --dport 443 -j ACCEPT' 478 | echo '-A INPUT -p tcp -m state --state NEW -m tcp --dport 7080 -j ACCEPT' 479 | ) -i -- /etc/iptables/rules.v4 480 | fi 481 | } 482 | 483 | centos_install_firewall(){ 484 | echoG '[Start] Install Firewall' 485 | if [ ! -e /usr/sbin/firewalld ]; then 486 | yum -y install firewalld > /dev/null 2>&1 487 | fi 488 | service firewalld start > /dev/null 2>&1 489 | systemctl enable firewalld > /dev/null 2>&1 490 | echoG '[End] Install Firewall' 491 | } 492 | 493 | centos_config_firewall(){ 494 | echoG '[Start] Setting Firewall' 495 | for PORT in ${FIREWALLLIST}; do 496 | firewall-cmd --permanent --add-port=${PORT}/tcp > /dev/null 2>&1 497 | done 498 | firewall-cmd --reload > /dev/null 2>&1 499 | firewall-cmd --list-all | grep 80 > /dev/null 2>&1 500 | if [ ${?} = 0 ]; then 501 | echoG '[End] Setting Firewall' 502 | else 503 | echoR '[X] Please check firewalld rules' 504 | fi 505 | if [ ${PROVIDER} = 'oracle' ]; then 506 | oci_iptables 507 | fi 508 | } 509 | 510 | ubuntu_config_firewall(){ 511 | echoG '[Start] Setting Firewall' 512 | #ufw status verbose | grep inactive > /dev/null 2>&1 513 | #if [ ${?} = 0 ]; then 514 | for PORT in ${FIREWALLLIST}; do 515 | ufw allow ${PORT} > /dev/null 2>&1 516 | done 517 | echo "y" | ufw enable > /dev/null 2>&1 518 | 519 | ufw status | grep '80.*ALLOW' > /dev/null 2>&1 520 | if [ ${?} = 0 ]; then 521 | echoG '[End] Setting Firewall' 522 | else 523 | echoR '[X] Please check ufw rules' 524 | fi 525 | #else 526 | # echoG "ufw already enabled" 527 | #fi 528 | if [ ${PROVIDER} = 'oracle' ]; then 529 | oci_iptables 530 | fi 531 | } 532 | 533 | rm_dummy(){ 534 | echoG '[Start] Remove dummy file' 535 | rm -f "${NOWPATH}/example.csr" "${NOWPATH}/privkey.pem" 536 | echoG '[End] Remove dummy file' 537 | } 538 | 539 | init_check(){ 540 | START_TIME="$(date -u +%s)" 541 | check_os 542 | check_provider 543 | } 544 | 545 | centos_main_install(){ 546 | centos_install_basic 547 | centos_install_ols 548 | centos_install_nodejs 549 | centos_install_rbenv 550 | centos_install_ruby 551 | centos_install_gem 552 | centos_install_bundler 553 | centos_install_bundle 554 | centos_install_lsapi 555 | centos_install_rails 556 | centos_install_certbot 557 | centos_install_firewall 558 | } 559 | 560 | centos_main_config(){ 561 | centos_set_app 562 | centos_set_ols 563 | centos_config_firewall 564 | } 565 | 566 | ubuntu_main_install(){ 567 | ubuntu_install_basic 568 | ubuntu_install_ols 569 | ubuntu_install_nodejs 570 | ubuntu_install_rbenv 571 | ubuntu_install_ruby 572 | ubuntu_install_gem 573 | ubuntu_install_bundler 574 | ubuntu_install_bundle 575 | ubuntu_install_lsapi 576 | ubuntu_install_rails 577 | ubuntu_install_certbot 578 | } 579 | 580 | ubuntu_main_config(){ 581 | ubuntu_set_app 582 | ubuntu_set_ols 583 | ubuntu_config_firewall 584 | } 585 | 586 | list_version(){ 587 | echoG '=============Installed Versions============' 588 | printf "%-7s version: %-10s \n" 'NodeJS' "${NODE_V}" 589 | printf "%-7s version: %-10s \n" 'NPM' "${NPM_V}" 590 | printf "%-7s version: %-10s \n" 'rbenv' "$(echo ${RBEN_V} | awk '{print $2}')" 591 | printf "%-7s version: %-10s \n" 'Ruby' "$(echo ${RUBY_V} | awk '{print $2}')" 592 | printf "%-7s version: %-10s \n" 'gem' "${GEM_V}" 593 | printf "%-7s version: %-10s \n" 'Bundler' "$(echo ${BUNDLER_V} | awk '{print $3}')" 594 | printf "%-7s version: %-10s \n" 'Rails' "$(echo ${RAILS_V} | awk '{print $2}')" 595 | echoG '===========================================' 596 | } 597 | 598 | end_message(){ 599 | rm_dummy 600 | END_TIME="$(date -u +%s)" 601 | ELAPSED="$((${END_TIME}-${START_TIME}))" 602 | echoY "***Total of ${ELAPSED} seconds to finish process***" 603 | list_version 604 | } 605 | 606 | main(){ 607 | init_check 608 | if [ ${OSNAME} = 'centos' ]; then 609 | centos_sys_upgrade 610 | centos_main_install 611 | centos_main_config 612 | else 613 | ubuntu_sys_upgrade 614 | ubuntu_main_install 615 | ubuntu_main_config 616 | fi 617 | acme_folder 618 | restart_lsws 619 | change_owner 620 | end_message 621 | } 622 | 623 | main 624 | exit 0 -------------------------------------------------------------------------------- /_image/cyberpanel_50.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 15 | 16 | 28 | 42 | 50 | 51 | 62 | 63 | 64 | 65 | 68 | 73 | 78 | 81 | 82 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /_image/django_50.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 12 | 15 | 26 | 27 | 31 | 36 | 49 | 50 | -------------------------------------------------------------------------------- /_image/drupal_50.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 16 | 19 | 30 | 31 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /_image/joomla_50.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 18 | 21 | 22 | 33 | 34 | 36 | 42 | 44 | 51 | 58 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /_image/lsws_50.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 16 | 23 | 24 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /_image/nodejs_50.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 14 | 17 | 28 | 29 | 49 | 50 | -------------------------------------------------------------------------------- /_image/openlitespeed-git-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litespeedtech/ls-cloud-image/939e24cca4ee3bbcd4a1a7f55a3cf2b41fc2615a/_image/openlitespeed-git-icon.png -------------------------------------------------------------------------------- /_image/openlitespeed-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litespeedtech/ls-cloud-image/939e24cca4ee3bbcd4a1a7f55a3cf2b41fc2615a/_image/openlitespeed-icon.png -------------------------------------------------------------------------------- /_image/ruby_50.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 21 | 25 | 41 | 42 | 44 | 47 | 51 | 59 | 89 | 90 | 91 | 92 | 93 | 94 | 96 | 97 | 98 | 99 | 100 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /_image/wp_50.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 12 | 15 | 22 | 42 | 43 | -------------------------------------------------------------------------------- /scripts/data-storage-node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | USER='www-data' 3 | GROUP='www-data' 4 | HMPATH='/root' 5 | DBPASSPATH="${HMPATH}/.db_password" 6 | APT='apt-get -qq' 7 | YUM='yum -q' 8 | DATA_STO_DIR='/var/nfs/wp' 9 | LAN_IP_FILTER='10.' 10 | FILTER_NETMASK='20' 11 | ALLERRORS=0 12 | 13 | function echoY 14 | { 15 | FLAG=$1 16 | shift 17 | echo -e "\033[38;5;148m$FLAG\033[39m$@" 18 | } 19 | 20 | function echoG 21 | { 22 | FLAG=$1 23 | shift 24 | echo -e "\033[38;5;71m$FLAG\033[39m$@" 25 | } 26 | 27 | function echoB 28 | { 29 | FLAG=$1 30 | shift 31 | echo -e "\033[38;1;34m$FLAG\033[39m$@" 32 | } 33 | 34 | function echoR 35 | { 36 | FLAG=$1 37 | shift 38 | echo -e "\033[38;5;203m$FLAG\033[39m$@" 39 | } 40 | 41 | function echoW 42 | { 43 | FLAG=${1} 44 | shift 45 | echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}" 46 | } 47 | 48 | function echoNW 49 | { 50 | FLAG=${1} 51 | shift 52 | echo -e "\033[1m${FLAG}\033[0m${@}" 53 | } 54 | 55 | function echoCYAN 56 | { 57 | FLAG=$1 58 | shift 59 | echo -e "\033[1;36m$FLAG\033[0m$@" 60 | } 61 | 62 | function silent 63 | { 64 | if [ "${VERBOSE}" = '1' ] ; then 65 | "$@" 66 | else 67 | "$@" >/dev/null 2>&1 68 | fi 69 | } 70 | 71 | function check_root 72 | { 73 | local INST_USER=`id -u` 74 | if [ $INST_USER != 0 ] ; then 75 | echoR "Sorry, only the root user can install." 76 | echo 77 | exit 1 78 | fi 79 | } 80 | 81 | function check_rsync 82 | { 83 | which rsync >/dev/null 2>&1 84 | if [ $? != 0 ] ; then 85 | if [ "$OSNAME" = "centos" ] ; then 86 | silent ${YUM} -y install rsync 87 | else 88 | ${APT} -y install rsync 89 | fi 90 | 91 | which rsync >/dev/null 2>&1 92 | if [ $? != 0 ] ; then 93 | echoR "An error occured during rsync installation." 94 | ALLERRORS=1 95 | fi 96 | fi 97 | } 98 | 99 | function check_provider 100 | { 101 | if [ "$(dmidecode -s bios-vendor)" = 'Vultr' ];then 102 | echoG 'Platform Provider is Vultr' 103 | else 104 | echoR 'Platform Provider is not Vultr, do you still want to continue? [y/N] ' 105 | read TMP_YN 106 | if [[ "${TMP_YN}" =~ ^(y|Y) ]]; then 107 | echoG 'Continue the setup' 108 | else 109 | exit 0 110 | fi 111 | fi 112 | } 113 | 114 | function check_lan_ipv4 115 | { 116 | ### Filter IP start from 10.* 117 | FILTER_RESULT=$(ip -4 addr | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -e "^${LAN_IP_FILTER}") 118 | FILTER_MATCH_NUM="$(ip -4 addr | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -e "^${LAN_IP_FILTER}" | wc -l)" 119 | if [ "${FILTER_MATCH_NUM}" = '0' ]; then 120 | echoR "No IP mathc with ^${LAN_IP_FILTER} filter, please check manually! exit! " 121 | ip addr; exit 1 122 | elif [ "${FILTER_MATCH_NUM}" = '1' ]; then 123 | echoG "Found IP for NFS service: ${FILTER_RESULT}" 124 | else 125 | echoY "Found multiple IP match with ^${LAN_IP_FILTER} filter, please check it manually! exit!" 126 | ip addr; exit 1 127 | fi 128 | FILTER_NETMASK=$(ip -4 addr | grep "${FILTER_RESULT}" | awk -F '/' '{ print $2 }' | cut -f 1 -d " ") 129 | } 130 | 131 | function usage 132 | { 133 | echo -e "\033[1mOPTIONS\033[0m" 134 | echoW " --dbname [DATABASENAME] " "To set the database name in the database instead of using a random one." 135 | echoW " --dbuser [DBUSERNAME] " "To set the APP username in the database instead of using a random one." 136 | echoW " --dbpassword [PASSWORD] " "To set the APP user password in database instead of using a random one." 137 | echoNW " -H, --help " "${EPACE} To display help messages." 138 | echo 139 | exit 0 140 | } 141 | 142 | function change_owner 143 | { 144 | chown -R ${USER}:${GROUP} ${1} 145 | } 146 | 147 | function prepare_data_dir 148 | { 149 | mkdir -p "${DATA_STO_DIR}" 150 | change_owner "${DATA_STO_DIR}" 151 | } 152 | 153 | function centos_install_nfs 154 | { 155 | silent ${YUM} -y install nfs-utils nfs-utils-lib 156 | } 157 | 158 | 159 | function debian_install_nfs 160 | { 161 | silent ${APT} -y install nfs-kernel-server 162 | } 163 | 164 | function install_nfs 165 | { 166 | echoG 'Install nfs' 167 | if [ "$OSNAME" = "centos" ] ; then 168 | centos_install_nfs 169 | else 170 | debian_install_nfs 171 | fi 172 | } 173 | 174 | function set_nfs 175 | { 176 | echoG 'Config nfs' 177 | FIRST_THREE_SEC=${FILTER_RESULT%.*} 178 | echo "${DATA_STO_DIR} ${FIRST_THREE_SEC}.0/${FILTER_NETMASK}(rw,sync,no_root_squash,no_subtree_check)" >> /etc/exports 179 | 180 | if [ "$OSNAME" = "centos" ] ; then 181 | silent systemctl restart nfs 182 | else 183 | silent systemctl restart nfs-kernel-server 184 | fi 185 | } 186 | 187 | 188 | function disable_needrestart 189 | { 190 | if [ -d /etc/needrestart/conf.d ]; then 191 | echoG 'List Restart services only' 192 | cat >> /etc/needrestart/conf.d/disable.conf </dev/null 2>&1 205 | else 206 | disable_needrestart 207 | silent ${APT} update && ${APT} upgrade -y >/dev/null 2>&1 208 | fi 209 | } 210 | 211 | function check_os 212 | { 213 | if [ -f /etc/centos-release ] ; then 214 | OSNAME=centos 215 | elif [ -f /etc/redhat-release ] ; then 216 | OSNAME=centos 217 | elif [ -f /etc/lsb-release ] ; then 218 | OSNAME=ubuntu 219 | elif [ -f /etc/debian_version ] ; then 220 | OSNAME=debian 221 | else 222 | echoR 'Platform is not support, exit!'; exit 1 223 | fi 224 | } 225 | 226 | function db_password_file 227 | { 228 | echoG 'Create db fiile' 229 | if [ -f ${DBPASSPATH} ]; then 230 | echoY "${DBPASSPATH} already exist!, will recreate a new file" 231 | rm -f ${DBPASSPATH} 232 | fi 233 | touch "${DBPASSPATH}" 234 | } 235 | 236 | function save_db_root_pwd 237 | { 238 | echo "mysql root password is [$ROOTPASSWORD]." >> ${DBPASSPATH} 239 | } 240 | 241 | function save_db_user_pwd 242 | { 243 | echo "mysql WordPress DataBase name is [$DATABASENAME], username is [$USERNAME], password is [$USERPASSWORD]." >> ${DBPASSPATH} 244 | } 245 | 246 | function random_password 247 | { 248 | if [ ! -z ${1} ]; then 249 | TEMPPASSWORD="${1}" 250 | else 251 | TEMPPASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 ; echo '') 252 | fi 253 | } 254 | 255 | function random_strong_password 256 | { 257 | if [ ! -z ${1} ]; then 258 | TEMPPASSWORD="${1}" 259 | else 260 | TEMPPASSWORD=$(openssl rand -base64 32) 261 | fi 262 | } 263 | 264 | function main_gen_password 265 | { 266 | random_strong_password "${ROOTPASSWORD}" 267 | ROOTPASSWORD="${TEMPPASSWORD}" 268 | random_password "${USERNAME}" 269 | USERNAME="${TEMPPASSWORD}" 270 | random_password "${DATABASENAME}" 271 | DATABASENAME="${TEMPPASSWORD}" 272 | random_strong_password "${USERPASSWORD}" 273 | USERPASSWORD="${TEMPPASSWORD}" 274 | } 275 | 276 | function centos_install_mariadb 277 | { 278 | echoB "${FPACE} - Install MariaDB" 279 | silent ${YUM} -y install MariaDB-server MariaDB-client 280 | silent systemctl enable mariadb 281 | silent systemctl start mariadb 282 | } 283 | 284 | function debian_install_mariadb 285 | { 286 | echoB "${FPACE} - Install MariaDB" 287 | silent ${APT} -y install mariadb-server 288 | silent service mysql start 289 | if [ ${?} != 0 ]; then 290 | service mariadb start 291 | fi 292 | } 293 | 294 | function check_cur_status 295 | { 296 | which mariadb >/dev/null 2>&1 297 | if [ $? = 0 ] ; then 298 | echoY 'MariaDB is already installed, exit!'; exit 1 299 | fi 300 | } 301 | 302 | function install_mariadb 303 | { 304 | echoG "Start Install MariaDB" 305 | if [ "$OSNAME" = 'centos' ] ; then 306 | centos_install_mariadb 307 | else 308 | debian_install_mariadb 309 | fi 310 | if [ $? != 0 ] ; then 311 | echoR "An error occured when starting the MariaDB service. " 312 | echoR "Please fix this error and try again. Aborting installation!" 313 | exit 1 314 | fi 315 | echoG "End Install MariaDB" 316 | } 317 | 318 | function set_db_root 319 | { 320 | echoB "${FPACE} - Set MariaDB root" 321 | mysql -uroot -e "flush privileges;" 322 | mysqladmin -uroot -p$ROOTPASSWORD password $ROOTPASSWORD 323 | if [ $? != 0 ] ; then 324 | echoR "Failed to set MySQL root password to $ROOTPASSWORD, it may already have a root password." 325 | fi 326 | } 327 | 328 | function set_db_user 329 | { 330 | echoB "${FPACE} - Set MariaDB user" 331 | mysql -uroot -p$ROOTPASSWORD -e "DELETE FROM mysql.user WHERE User = '$USERNAME@localhost';" 332 | echo `mysql -uroot -p$ROOTPASSWORD -e "SELECT user FROM mysql.user"` | grep "$USERNAME" >/dev/null 333 | if [ $? = 0 ] ; then 334 | echoG "user $USERNAME exists in mysql.user" 335 | else 336 | mysql -uroot -p$ROOTPASSWORD -e "CREATE USER $USERNAME@localhost IDENTIFIED BY '$USERPASSWORD';" 337 | if [ $? = 0 ] ; then 338 | mysql -uroot -p$ROOTPASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO '$USERNAME'@localhost IDENTIFIED BY '$USERPASSWORD';" 339 | else 340 | echoR "Failed to create MySQL user $USERNAME. This user may already exist. If it does not, another problem occured." 341 | echoR "Please check this and update the wp-config.php file." 342 | ERROR="Create user error" 343 | fi 344 | fi 345 | mysql -uroot -p$ROOTPASSWORD -e "CREATE DATABASE IF NOT EXISTS $DATABASENAME;" 346 | if [ $? = 0 ] ; then 347 | mysql -uroot -p$ROOTPASSWORD -e "GRANT ALL PRIVILEGES ON $DATABASENAME.* TO '$USERNAME'@localhost IDENTIFIED BY '$USERPASSWORD';" 348 | else 349 | echoR "Failed to create database $DATABASENAME. It may already exist. If it does not, another problem occured." 350 | echoR "Please check this and update the wp-config.php file." 351 | if [ "x$ERROR" = "x" ] ; then 352 | ERROR="Create database error" 353 | else 354 | ERROR="$ERROR and create database error" 355 | fi 356 | fi 357 | mysql -uroot -p$ROOTPASSWORD -e "flush privileges;" 358 | 359 | if [ "x$ERROR" = "x" ] ; then 360 | echoG "Finished MySQL setup without error." 361 | else 362 | echoR "Finished MySQL setup - some error(s) occured." 363 | fi 364 | } 365 | 366 | function check_value_follow 367 | { 368 | FOLLOWPARAM=$1 369 | local PARAM=$1 370 | local KEYWORD=$2 371 | 372 | if [ "$1" = "-n" ] || [ "$1" = "-e" ] || [ "$1" = "-E" ] ; then 373 | FOLLOWPARAM= 374 | else 375 | local PARAMCHAR=$(echo $1 | awk '{print substr($0,1,1)}') 376 | if [ "$PARAMCHAR" = "-" ] ; then 377 | FOLLOWPARAM= 378 | fi 379 | fi 380 | 381 | if [ -z "$FOLLOWPARAM" ] ; then 382 | if [ ! -z "$KEYWORD" ] ; then 383 | echoR "Error: '$PARAM' is not a valid '$KEYWORD', please check and try again." 384 | usage 385 | fi 386 | fi 387 | } 388 | 389 | function befor_install_display 390 | { 391 | echo 392 | echoCYAN "Starting to setup Data Storae Node on Vultr server with the parameters below," 393 | echoY "MariaDB root Password: " "$ROOTPASSWORD" 394 | echoY "Database name: " "$DATABASENAME" 395 | echoY "Database username: " "$USERNAME" 396 | echoY "Database password: " "$USERPASSWORD" 397 | echo 398 | echoNW "Your password will be written to file: ${DBPASSPATH}" 399 | printf 'Are these settings correct? Type n to quit, otherwise will continue. [Y/n] ' 400 | read answer 401 | if [ "$answer" = "N" ] || [ "$answer" = "n" ] ; then 402 | echoG "Aborting installation!" 403 | exit 0 404 | fi 405 | echoCYAN 'Start OpenLiteSpeed one click installation >> >> >> >> >> >> >>' 406 | } 407 | 408 | function after_install_display 409 | { 410 | if [ "$ALLERRORS" = "0" ] ; then 411 | echoG "Congratulations! Installation finished." 412 | else 413 | echoY "Installation finished. Some errors seem to have occured, please check this as you may need to manually fix them." 414 | fi 415 | echoCYAN 'End OpenLiteSpeed one click installation << << << << << << <<' 416 | echo 417 | } 418 | 419 | function main_mariadb 420 | { 421 | install_mariadb 422 | set_db_root 423 | save_db_root_pwd 424 | set_db_user 425 | save_db_user_pwd 426 | } 427 | 428 | function main_nfs 429 | { 430 | install_nfs 431 | prepare_data_dir 432 | set_nfs 433 | } 434 | 435 | function main_init_check 436 | { 437 | check_root 438 | check_os 439 | check_provider 440 | check_lan_ipv4 441 | check_cur_status 442 | } 443 | 444 | function main_init_package 445 | { 446 | update_system 447 | check_rsync 448 | check_curl 449 | } 450 | 451 | function main 452 | { 453 | main_init_check 454 | main_gen_password 455 | befor_install_display 456 | main_mariadb 457 | main_nfs 458 | after_install_display 459 | } 460 | 461 | 462 | while [ ! -z "${1}" ] ; do 463 | case "${1}" in 464 | --dbname ) 465 | check_value_follow "$2" "database name" 466 | shift 467 | DATABASENAME=$FOLLOWPARAM 468 | ;; 469 | --dbuser ) 470 | check_value_follow "$2" "database username" 471 | shift 472 | USERNAME=$FOLLOWPARAM 473 | ;; 474 | --dbpassword ) 475 | check_value_follow "$2" "" 476 | if [ ! -z "$FOLLOWPARAM" ] ; then shift; fi 477 | USERPASSWORD=$FOLLOWPARAM 478 | ;; 479 | -[hH] | --help ) 480 | usage 481 | ;; 482 | * ) 483 | usage 484 | ;; 485 | esac 486 | shift 487 | done 488 | 489 | main -------------------------------------------------------------------------------- /scripts/fix-repo-os-name.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | OSNAMEVER=UNKNOWN 3 | OSNAME= 4 | OSVER= 5 | 6 | function check_os 7 | { 8 | if [ -f /etc/redhat-release ] ; then 9 | OSNAME=centos 10 | USER='nobody' 11 | GROUP='nobody' 12 | case $(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f1) in 13 | 6) 14 | OSNAMEVER=CENTOS6 15 | OSVER=6 16 | ;; 17 | 7) 18 | OSNAMEVER=CENTOS7 19 | OSVER=7 20 | ;; 21 | 8) 22 | OSNAMEVER=CENTOS8 23 | OSVER=8 24 | ;; 25 | 9) 26 | OSNAMEVER=CENTOS9 27 | OSVER=9 28 | ;; 29 | esac 30 | elif [ -f /etc/lsb-release ] ; then 31 | OSNAME=ubuntu 32 | USER='nobody' 33 | GROUP='nogroup' 34 | case $(cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2) in 35 | trusty) 36 | OSNAMEVER=UBUNTU14 37 | OSVER=trusty 38 | MARIADBCPUARCH="arch=amd64,i386,ppc64el" 39 | ;; 40 | xenial) 41 | OSNAMEVER=UBUNTU16 42 | OSVER=xenial 43 | MARIADBCPUARCH="arch=amd64,i386,ppc64el" 44 | ;; 45 | bionic) 46 | OSNAMEVER=UBUNTU18 47 | OSVER=bionic 48 | MARIADBCPUARCH="arch=amd64" 49 | ;; 50 | focal) 51 | OSNAMEVER=UBUNTU20 52 | OSVER=focal 53 | MARIADBCPUARCH="arch=amd64" 54 | ;; 55 | jammy) 56 | OSNAMEVER=UBUNTU22 57 | OSVER=jammy 58 | MARIADBCPUARCH="arch=amd64" 59 | ;; 60 | esac 61 | elif [ -f /etc/debian_version ] ; then 62 | OSNAME=debian 63 | case $(cat /etc/os-release | grep VERSION_CODENAME | cut -d = -f 2) in 64 | jessie) 65 | OSNAMEVER=DEBIAN8 66 | OSVER=jessie 67 | MARIADBCPUARCH="arch=amd64,i386" 68 | ;; 69 | stretch) 70 | OSNAMEVER=DEBIAN9 71 | OSVER=stretch 72 | MARIADBCPUARCH="arch=amd64,i386" 73 | ;; 74 | buster) 75 | OSNAMEVER=DEBIAN10 76 | OSVER=buster 77 | MARIADBCPUARCH="arch=amd64,i386" 78 | ;; 79 | bullseye) 80 | OSNAMEVER=DEBIAN11 81 | OSVER=bullseye 82 | MARIADBCPUARCH="arch=amd64,i386" 83 | ;; 84 | esac 85 | fi 86 | } 87 | 88 | 89 | function centos_update_repo_os 90 | { 91 | echo 'No need to update for CentOS!' 92 | } 93 | 94 | function debian_update_repo_os 95 | { 96 | MARIADB_REPO_PATH='/etc/apt/sources.list.d/mariadb.list' 97 | if [ -z ${MARIADB_REPO_PATH} ]; then 98 | echo "${MARIADB_REPO_PATH} is not found, exist!"; exit 1 99 | fi 100 | REPO_OS="$(awk '{print $(NF-1)}' ${MARIADB_REPO_PATH})" 101 | if [[ ${REPO_OS} = @(trusty|xenial|bionic|focal|jammy|jessie|stretch|buster|bullseye) ]]; then 102 | echo "Existing string on Repo: ${REPO_OS}" 103 | else 104 | echo "${REPO_OS} is not on the list, exist!"; exit 1 105 | fi 106 | echo "Replace ${REPO_OS} with ${OSVER}" 107 | sed -i "s/${REPO_OS}/${OSVER}/g" ${MARIADB_REPO_PATH} 108 | echo 'Finished' 109 | } 110 | 111 | main(){ 112 | check_os 113 | if [ ${OSNAME} = 'centos' ]; then 114 | centos_update_repo_os 115 | else 116 | debian_update_repo_os 117 | fi 118 | } 119 | 120 | main 121 | 122 | 123 | -------------------------------------------------------------------------------- /scripts/generate_ecc.sh: -------------------------------------------------------------------------------- 1 | #/usr/bin/env bash 2 | letsencrypt_path='/etc/letsencrypt/live/' 3 | CSR_CONF_FILE='csr.conf' 4 | LSDIR='/usr/local/lsws' 5 | EPACE=' ' 6 | WWW_DOMAIN='' 7 | DOMAIN='' 8 | LOG_FILE='/tmp/ecc.log' 9 | 10 | check_input(){ 11 | if [ -z "${1}" ] || [ -z "${2}" ] || [ -z "${3}" ] 12 | then 13 | help_message 14 | exit 1 15 | fi 16 | } 17 | 18 | 19 | domainverify(){ 20 | curl -Is http://${DOMAIN}/ | grep -i 'LiteSpeed\|cloudflare' >> $LOG_FILE 2>&1 21 | if [ ${?} = 0 ]; then 22 | echoG "[OK] ${DOMAIN} is accessible." 23 | TYPE=1 24 | curl -Is http://${WWW_DOMAIN}/ | grep -i 'LiteSpeed\|cloudflare' >> $LOG_FILE 2>&1 25 | if [ ${?} = 0 ]; then 26 | echoG "[OK] ${WWW_DOMAIN} is accessible." 27 | TYPE=2 28 | else 29 | echo "${WWW_DOMAIN} is inaccessible." 30 | fi 31 | else 32 | echo "${DOMAIN} is inaccessible, please verify!"; exit 1 33 | fi 34 | } 35 | 36 | 37 | echow(){ 38 | FLAG=${1} 39 | shift 40 | echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}" 41 | } 42 | 43 | 44 | echoG() { 45 | echo -e "\033[38;5;71m${1}\033[39m" 46 | } 47 | 48 | 49 | generate_csr_conf_two_domains(){ 50 | echo "[ req ] 51 | prompt = no 52 | default_md = sha256 53 | req_extensions = req_ext 54 | distinguished_name = dn 55 | 56 | [ dn ] 57 | C=US 58 | ST=NJ 59 | L=Virtual 60 | O=LiteSpeedCommunity 61 | OU=Testing 62 | CN=$DOMAIN 63 | 64 | [ req_ext ] 65 | subjectAltName = @alt_names 66 | 67 | [ alt_names ] 68 | DNS.1 = $DOMAIN 69 | DNS.2 = $WWW_DOMAIN 70 | " >> $CSR_CONF_FILE 71 | } 72 | 73 | 74 | generate_ecc_ssl_certificate(){ 75 | w_domain=${1} 76 | w_email=${2} 77 | w_webroot=${3} 78 | w_path=$letsencrypt_path${w_domain}/ 79 | 80 | # get the $DOMAIN and $WWW_DOMAIN 81 | www_domain $w_domain 82 | 83 | # get TYPE1:(one domain) and TYPE2:(two domains) 84 | domainverify 85 | 86 | if [ -d $w_path ] 87 | then 88 | echo "folder exits: $w_path" 89 | rm ${w_path}ecc* >> $LOG_FILE 2>&1 90 | rm ${w_path}*pem >> $LOG_FILE 2>&1 91 | else 92 | echo "folder not exits, create path: $w_path" 93 | mkdir -p $w_path 94 | fi 95 | 96 | if [ ${TYPE} = 1 ]; then 97 | openssl ecparam -genkey -name secp384r1 | sudo openssl ec -out ecc.key >> $LOG_FILE 2>&1 98 | openssl req -new -sha256 -key ecc.key -nodes -out ecc.csr -outform pem >> $LOG_FILE 2>&1 <> $LOG_FILE 2>&1 112 | generate_csr_conf_two_domains $DOMAIN $WWW_DOMAIN >> $LOG_FILE 2>&1 113 | openssl req -new -sha256 -key ecc.key -nodes -out ecc.csr -outform pem -config $CSR_CONF_FILE >> $LOG_FILE 2>&1 114 | certbot certonly --non-interactive --agree-tos --email $w_email --webroot -w $w_webroot -d $DOMAIN -d $WWW_DOMAIN --csr ecc.csr 115 | else 116 | echo 'Unknown type!'; exit 2 117 | fi 118 | 119 | remove_temporary_file 120 | mv ecc* $w_path >> $LOG_FILE 2>&1 121 | mv *pem $w_path >> $LOG_FILE 2>&1 122 | echow "SSLCertificateFile /etc/letsencrypt/live/{DOMAIN}/0001_chain.pem" 123 | echow "SSLCertificateKeyFile /etc/letsencrypt/live/{DOMAIN}/ecc.key" 124 | 125 | } 126 | 127 | 128 | help_message(){ 129 | echo -e "\033[1mNAME\033[0m" 130 | echow "generate_ecc.sh - Generate ECC(elliptical curve cryptography) ECDSA" 131 | echo -e "\033[1mOPTIONS\033[0m" 132 | echow '-d' 133 | echo "${EPACE}${EPACE}Domain" 134 | echow '-e' 135 | echo "${EPACE}${EPACE}Email" 136 | echow '-w' 137 | echo "${EPACE}${EPACE}Website root folder" 138 | echow '-h, --help' 139 | echo "${EPACE}${EPACE}Display help." 140 | echo -e "\033[1mEXAMPLE\033[0m" 141 | echow "generate_ecc.sh -d 'example.com' -e 'john@email.com' -w '/var/www/public_html/'" 142 | echo -e "\033[1mvhost settings\033[0m" 143 | echow "SSLCertificateFile /etc/letsencrypt/live/{DOMAIN}/0001_chain.pem" 144 | echow "SSLCertificateKeyFile /etc/letsencrypt/live/{DOMAIN}/ecc.key" 145 | } 146 | 147 | 148 | restart_lsws(){ 149 | ${LSDIR}/bin/lswsctrl stop >> $LOG_FILE 2>&1 150 | systemctl stop lsws >> $LOG_FILE 2>&1 151 | systemctl start lsws >> $LOG_FILE 2>&1 152 | } 153 | 154 | 155 | remove_temporary_file(){ 156 | rm ${CSR_CONF_FILE} >> $LOG_FILE 2>&1 157 | } 158 | 159 | www_domain(){ 160 | CHECK_WWW=$(echo ${1} | cut -c1-4) 161 | if [[ ${CHECK_WWW} == www. ]] ; then 162 | DOMAIN=$(echo ${1} | cut -c 5-) 163 | else 164 | DOMAIN=${1} 165 | fi 166 | WWW_DOMAIN="www.${DOMAIN}" 167 | } 168 | 169 | 170 | # main 171 | while getopts :d:e:w: flag 172 | do 173 | case "${flag}" in 174 | d) domain=${OPTARG};; 175 | e) email=${OPTARG};; 176 | w) webroot=${OPTARG};; 177 | esac 178 | done 179 | 180 | check_input $domain $email $webroot 181 | 182 | if [ ! -z "${1}" ] 183 | then 184 | case ${1} in 185 | -[hH] | -help | --help) 186 | help_message 187 | ;; 188 | -[d]) 189 | generate_ecc_ssl_certificate $domain $email $webroot 190 | restart_lsws 191 | ;; 192 | *) 193 | help_message 194 | ;; 195 | esac 196 | fi 197 | --------------------------------------------------------------------------------