mirror of
https://github.com/10h30/ols-docker-env.git
synced 2026-06-05 15:09:15 +09:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b504ac6fd2 | |||
| 412e1e97e0 | |||
| 6d3f71b7cc | |||
| c7d05b793e | |||
| 3450c1f5ff | |||
| 43978444d7 | |||
| aad30b8fdf | |||
| daa65aa4af | |||
| 95928d1776 | |||
| f3e4a5ad24 | |||
| 2127bc1d8c | |||
| 4144b50fae | |||
| 6ab4d1fd98 | |||
| 97e3cbd3fb | |||
| f87fff6f96 | |||
| 10112fc897 | |||
| 356b2b33b8 | |||
| ffc7c5fdbe | |||
| 564755659a | |||
| 48b5828744 | |||
| 4d7ecbfad8 |
@@ -1,5 +1,5 @@
|
||||
TimeZone=America/New_York
|
||||
OLS_VERSION=1.6.9
|
||||
OLS_VERSION=1.6.13
|
||||
PHP_VERSION=lsphp74
|
||||
MYSQL_DATABASE=wordpress
|
||||
MYSQL_ROOT_PASSWORD=password
|
||||
|
||||
+4
-5
@@ -1,6 +1,5 @@
|
||||
language: bash
|
||||
|
||||
sudo: 'required'
|
||||
language: shell
|
||||
os: linux
|
||||
|
||||
notifications:
|
||||
email:
|
||||
@@ -22,7 +21,7 @@ env:
|
||||
- DOCKER_COMPOSE_VERSION=1.25.0
|
||||
|
||||
before_install:
|
||||
- ./.travis/main.sh
|
||||
- bash .travis/main.sh
|
||||
|
||||
install:
|
||||
- git clone https://github.com/litespeedtech/ols-docker-env.git
|
||||
@@ -33,7 +32,7 @@ before_script:
|
||||
- sleep 10
|
||||
|
||||
script:
|
||||
- ./.travis/verify.sh
|
||||
- bash .travis/verify.sh
|
||||
|
||||
after_script:
|
||||
- docker-compose stop
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Litespeedtech
|
||||
Copyright (c) 2019 - 2020 Litespeedtech
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,28 +1,31 @@
|
||||
# OpenLiteSpeed WordPress Docker Container (Beta)
|
||||
# OpenLiteSpeed WordPress Docker Container
|
||||
[](https://hub.docker.com/r/litespeedtech/openlitespeed)
|
||||
[](https://hub.docker.com/r/litespeedtech/openlitespeed)
|
||||
[](https://hub.docker.com/r/litespeedtech/openlitespeed)
|
||||
[](https://hub.docker.com/r/litespeedtech/openlitespeed-beta)
|
||||
[<img src="https://img.shields.io/badge/slack-LiteSpeed-blue.svg?logo=slack">](litespeedtech.com/slack)
|
||||
[<img src="https://img.shields.io/twitter/follow/litespeedtech.svg?label=Follow&style=social">](https://twitter.com/litespeedtech)
|
||||
|
||||
Install a Lightweight WordPress container with OpenLiteSpeed 1.6.5+ & PHP 7.3+ based on Ubuntu 18.04 Linux.
|
||||
Install a lightweight WordPress container with OpenLiteSpeed Edge or Stable version based on Ubuntu 18.04 Linux.
|
||||
|
||||
### Prerequisites
|
||||
1. [Install Docker](https://www.docker.com/)
|
||||
2. [Install Docker Compose](https://docs.docker.com/compose/)
|
||||
3. Clone this repository or copy the files from this repository into a new folder:
|
||||
```
|
||||
git clone https://github.com/litespeedtech/ols-docker-env.git
|
||||
```
|
||||
|
||||
## Configuration
|
||||
Edit the `.env` file to update the demo site domain, default MySQL user, and password.
|
||||
Feel free to check [Docker hub Tag page](https://hub.docker.com/repository/docker/litespeedtech/openlitespeed/tags) if you want to update default openlitespeed and php versions.
|
||||
|
||||
## Installation
|
||||
Clone this repository or copy the files from this repository into a new folder:
|
||||
```
|
||||
git clone https://github.com/litespeedtech/ols-docker-env.git
|
||||
```
|
||||
Open a terminal, `cd` to the folder in which `docker-compose.yml` is saved, and run:
|
||||
```
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
Note: If you wish to run a single web server container, please see the [usage method here](https://github.com/litespeedtech/ols-dockerfiles#usage).
|
||||
|
||||
## Components
|
||||
The docker image installs the following packages on your system:
|
||||
|
||||
@@ -31,17 +34,46 @@ The docker image installs the following packages on your system:
|
||||
|Linux|Ubuntu 18.04|
|
||||
|OpenLiteSpeed|[Latest version](https://openlitespeed.org/downloads/)|
|
||||
|MariaDB|[Stable version: 10.3](https://hub.docker.com/_/mariadb)|
|
||||
|PHP|[Stable version: 7.3](http://rpms.litespeedtech.com/debian/)|
|
||||
|PHP|[Latest version](http://rpms.litespeedtech.com/debian/)|
|
||||
|LiteSpeed Cache|[Latest from WordPress.org](https://wordpress.org/plugins/litespeed-cache/)|
|
||||
|Certbot|[Latest from Certbot's PPA](https://launchpad.net/~certbot/+archive/ubuntu/certbot)|
|
||||
|ACME|[Latest from ACME official](https://github.com/acmesh-official/get.acme.sh)|
|
||||
|WordPress|[Latest from WordPress](https://wordpress.org/download/)|
|
||||
|phpMyAdmin|[Latest from dockerhub](https://hub.docker.com/r/bitnami/phpmyadmin/)|
|
||||
|
||||
## Data Structure
|
||||
There is a `sites` directory next to your `docker-compose.yml` file, and it contains the following:
|
||||
Cloned project
|
||||
```bash
|
||||
├── acme
|
||||
├── bin
|
||||
│ └── container
|
||||
├── data
|
||||
│ └── db
|
||||
├── logs
|
||||
│ ├── access.log
|
||||
│ ├── error.log
|
||||
│ ├── lsrestart.log
|
||||
│ └── stderr.log
|
||||
├── lsws
|
||||
│ ├── admin-conf
|
||||
│ └── conf
|
||||
├── sites
|
||||
│ └── localhost
|
||||
├── LICENSE
|
||||
├── README.md
|
||||
└── docker-compose.yml
|
||||
```
|
||||
|
||||
* `sites/DOMAIN/html/` – Document root (the WordPress application will install here)
|
||||
* `sites/DOMAIN/logs/` - Access log storage
|
||||
* `acme` contains all applied certificates from Lets Encrypt
|
||||
|
||||
* `bin` contains multiple CLI scripts to allow you add or delete virtual hosts, install applications, upgrade, etc
|
||||
|
||||
* `data` stores the MySQL database
|
||||
|
||||
* `logs` contains all of the web server logs and virtual host access logs
|
||||
|
||||
* `lsws` contains all web server configuration files
|
||||
|
||||
* `sites` contains the document roots (the WordPress application will install here)
|
||||
|
||||
## Usage
|
||||
### Starting a Container
|
||||
@@ -54,7 +86,6 @@ You can run with daemon mode, like so:
|
||||
docker-compose up -d
|
||||
```
|
||||
The container is now built and running.
|
||||
|
||||
### Stopping a Container
|
||||
```
|
||||
docker-compose stop
|
||||
@@ -64,20 +95,6 @@ To stop and remove all containers, use the `down` command:
|
||||
```
|
||||
docker-compose down
|
||||
```
|
||||
### Installing Packages
|
||||
Edit the `docker-compose.yml` file, and add the package name as an `extensions` argument. We used `vim` in this example:
|
||||
```
|
||||
litespeed:
|
||||
build:
|
||||
context: ./config/litespeed/xxx/
|
||||
args:
|
||||
extensions: vim
|
||||
```
|
||||
After saving the changed configuration, run with `--build`:
|
||||
```
|
||||
docker-compose up --build
|
||||
```
|
||||
|
||||
### Setting the WebAdmin Password
|
||||
We strongly recommend you set your personal password right away.
|
||||
```
|
||||
@@ -90,35 +107,78 @@ bash bin/demosite.sh
|
||||
```
|
||||
### Creating a Domain and Virtual Host
|
||||
```
|
||||
bash bin/domain.sh -add example.com
|
||||
bash bin/domain.sh [-A, --add] example.com
|
||||
```
|
||||
> Please ignore SSL certificate warnings from the server. They happen if you haven't applied the certificate.
|
||||
### Deleting a Domain and Virtual Host
|
||||
```
|
||||
bash bin/domain.sh [-D, --del] example.com
|
||||
```
|
||||
### Creating a Database
|
||||
You can either automatically generate the user, password, and database names, or specify them. Use the following to auto generate:
|
||||
```
|
||||
bash bin/database.sh -domain example.com
|
||||
bash bin/database.sh [-D, --domain] example.com
|
||||
```
|
||||
Use this command to specify your own names, substituting `user_name`, `my_password`, and `database_name` with your preferred values:
|
||||
```
|
||||
bash bin/database.sh -domain example.com -user user_name -password my_password -database database_name
|
||||
bash bin/database.sh [-D, --domain] example.com [-U, --user] USER_NAME [-P, --password] MY_PASS [-DB, --database] DATABASE_NAME
|
||||
```
|
||||
### Installing a WordPress Site
|
||||
To preconfigure the `wp-config` file, run the `database.sh` script for your domain, before you use the following command to install WordPress:
|
||||
```
|
||||
./bin/appinstall.sh -app wordpress -domain example.com
|
||||
./bin/appinstall.sh [-A, --app] wordpress [-D, --domain] example.com
|
||||
```
|
||||
### Install ACME
|
||||
We need to run the ACME installation command the **first time only**.
|
||||
With email notification:
|
||||
```
|
||||
./bin/acme.sh [-I, --install] [-E, --email] EMAIL_ADDR
|
||||
```
|
||||
Without email notification:
|
||||
```
|
||||
./bin/acme.sh [-I, --install] [-NE, --no-email]
|
||||
```
|
||||
### Applying a Let's Encrypt Certificate
|
||||
Use the root domain in this command, and it will check for a certificate and automatically apply one with and without `www`:
|
||||
```
|
||||
./bin/cert.sh example.com
|
||||
./bin/acme.sh [-D, --domain] example.com
|
||||
```
|
||||
### Update Web Server
|
||||
To upgrade web server to latest stable version, run
|
||||
To upgrade the web server to latest stable version, run the following:
|
||||
```
|
||||
bash bin/webadmin.sh -lsup
|
||||
bash bin/webadmin.sh [-U, --upgrade]
|
||||
```
|
||||
|
||||
### Apply OWASP ModSecurity
|
||||
Enable OWASP `mod_secure` on the web server:
|
||||
```
|
||||
bash bin/webadmin.sh [-M, --mod-secure] enable
|
||||
```
|
||||
Disable OWASP `mod_secure` on the web server:
|
||||
```
|
||||
bash bin/webadmin.sh [-M, --mod-secure] disable
|
||||
```
|
||||
>Please ignore ModSecurity warnings from the server. They happen if some of the rules are not supported by the server.
|
||||
### Accessing the Database
|
||||
After installation, you can use phpMinAdmin to access the database by visiting http://127.0.0.1:8080 or https://127.0.0.1:8443. The default username is `root`, and the password is the same as the one you supplied in the `.env` file.
|
||||
After installation, you can use phpMyAdmin to access the database by visiting `http://127.0.0.1:8080` or `https://127.0.0.1:8443`. The default username is `root`, and the password is the same as the one you supplied in the `.env` file.
|
||||
|
||||
## Customization
|
||||
If you want to customize the image by adding some packages, e.g. `lsphp74-pspell`, just extend it with a Dockerfile.
|
||||
1. We can create a `custom` folder and a `custom/Dockerfile` file under the main project.
|
||||
2. Add the following example code to `Dockerfile` under the custom folder
|
||||
```
|
||||
FROM litespeedtech/openlitespeed:latest
|
||||
RUN apt-get update && apt-get install lsphp74-pspell -y
|
||||
```
|
||||
3. Add `build: ./custom` line under the "image: litespeedtech" of docker-composefile. So it will looks like this
|
||||
```
|
||||
litespeed:
|
||||
image: litespeedtech/openlitespeed:${OLS_VERSION}-${PHP_VERSION}
|
||||
build: ./custom
|
||||
```
|
||||
4. Build and start it with command:
|
||||
```
|
||||
docker-compose up --build
|
||||
```
|
||||
|
||||
## Support & Feedback
|
||||
If you still have a question after using OpenLiteSpeed Docker, you have a few options.
|
||||
|
||||
+25
-13
@@ -7,6 +7,13 @@ UNINSTALL=''
|
||||
TYPE=0
|
||||
CONT_NAME='litespeed'
|
||||
ACME_SRC='https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh'
|
||||
EPACE=' '
|
||||
|
||||
echow(){
|
||||
FLAG=${1}
|
||||
shift
|
||||
echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}"
|
||||
}
|
||||
|
||||
help_message(){
|
||||
case ${1} in
|
||||
@@ -14,17 +21,22 @@ help_message(){
|
||||
echo 'You will need to install acme script at the first time.'
|
||||
echo 'Please run acme.sh --install --email example@example.com'
|
||||
;;
|
||||
"2")
|
||||
echo 'Command [--install] [--email EMAIL_ADDR]'
|
||||
echo 'Command [--install] [--no-email]'
|
||||
echo 'Command [--domain DOMAIN_NAME]'
|
||||
echo 'Example: acme.sh --install --email example@example.com'
|
||||
echo 'Example: acme.sh --install --no-email'
|
||||
echo 'Example: acme.sh --domain example.com'
|
||||
"2")
|
||||
echo -e "\033[1mOPTIONS\033[0m"
|
||||
echow '-D, --domain [DOMAIN_NAME]'
|
||||
echo "${EPACE}${EPACE}Example: acme.sh --domain example.com"
|
||||
echo "${EPACE}${EPACE}will auto detect and apply for both example.com and www.example.com domains."
|
||||
echow '-H, --help'
|
||||
echo "${EPACE}${EPACE}Display help and exit."
|
||||
echo -e "\033[1m Only for the First time\033[0m"
|
||||
echow '--install --email [EMAIL_ADDR]'
|
||||
echo "${EPACE}${EPACE}Will install ACME with the Email provided"
|
||||
echow '--install --no-email'
|
||||
echo "${EPACE}${EPACE}Will install ACME without the Email."
|
||||
exit 0
|
||||
;;
|
||||
"3")
|
||||
echo 'Please run acme.sh -domain example.com to apply certificate'
|
||||
echo 'Please run acme.sh --domain [DOMAIN_NAME] to apply certificate'
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
@@ -178,22 +190,22 @@ while [ ! -z "${1}" ]; do
|
||||
-[hH] | -help | --help)
|
||||
help_message 2
|
||||
;;
|
||||
-d | -domain | --domain) shift
|
||||
-[dD] | -domain | --domain) shift
|
||||
check_input "${1}"
|
||||
DOMAIN="${1}"
|
||||
;;
|
||||
-i | --install )
|
||||
-[iI] | --install )
|
||||
INSTALL=true
|
||||
;;
|
||||
-u | --uninstall )
|
||||
-[uU] | --uninstall )
|
||||
UNINSTALL=true
|
||||
uninstall_acme
|
||||
;;
|
||||
-e | --email ) shift
|
||||
-[eE] | --email ) shift
|
||||
check_input "${1}"
|
||||
EMAIL="${1}"
|
||||
;;
|
||||
-ne | --no-email ) shift
|
||||
-NE | --no-email ) shift
|
||||
NO_EMAIL=true
|
||||
;;
|
||||
*)
|
||||
|
||||
+17
-5
@@ -1,10 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
APP_NAME=''
|
||||
DOMAIN=''
|
||||
EPACE=' '
|
||||
|
||||
echow(){
|
||||
FLAG=${1}
|
||||
shift
|
||||
echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}"
|
||||
}
|
||||
|
||||
help_message(){
|
||||
echo 'Command [-app app_name] [-domain domain_name]'
|
||||
echo 'Example: appinstall.sh -app wordpress -d example.com'
|
||||
echo -e "\033[1mOPTIONS\033[0m"
|
||||
echow '-A, --app [app_name] -D, --domain [DOMAIN_NAME]'
|
||||
echo "${EPACE}${EPACE}Example: appinstall.sh -A wordpress -D example.com"
|
||||
echo "${EPACE}${EPACE}Will install WordPress CMS under the example.com domain"
|
||||
echow '-H, --help'
|
||||
echo "${EPACE}${EPACE}Display help and exit."
|
||||
exit 0
|
||||
}
|
||||
|
||||
check_input(){
|
||||
@@ -15,7 +27,7 @@ check_input(){
|
||||
}
|
||||
|
||||
app_download(){
|
||||
docker-compose exec litespeed su -c "appinstallctl.sh -app ${1} -domain ${2}"
|
||||
docker-compose exec litespeed su -c "appinstallctl.sh --app ${1} --domain ${2}"
|
||||
bash bin/webadmin.sh -r
|
||||
exit 0
|
||||
}
|
||||
@@ -30,11 +42,11 @@ while [ ! -z "${1}" ]; do
|
||||
-[hH] | -help | --help)
|
||||
help_message
|
||||
;;
|
||||
-app | -a | -A) shift
|
||||
-[aA] | -app | --app) shift
|
||||
check_input "${1}"
|
||||
APP_NAME="${1}"
|
||||
;;
|
||||
-d | -D | -domain) shift
|
||||
-[dD] | -domain | --domain) shift
|
||||
check_input "${1}"
|
||||
DOMAIN="${1}"
|
||||
;;
|
||||
|
||||
+387
-34
@@ -11,11 +11,21 @@ PUB_IP=$(curl -s http://checkip.amazonaws.com)
|
||||
DB_HOST='mysql'
|
||||
PLUGINLIST="litespeed-cache.zip"
|
||||
THEME='twentytwenty'
|
||||
EPACE=' '
|
||||
|
||||
echow(){
|
||||
FLAG=${1}
|
||||
shift
|
||||
echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}"
|
||||
}
|
||||
|
||||
help_message(){
|
||||
echo 'Command [-app app_name] [-domain domain_name]'
|
||||
echo 'Example: appinstallctl.sh -app wordpress -d example.com'
|
||||
exit 0
|
||||
echo -e "\033[1mOPTIONS\033[0m"
|
||||
echow '-A, -app [wordpress] -D, --domain [DOMAIN_NAME]'
|
||||
echo "${EPACE}${EPACE}Example: appinstallctl.sh --app wordpress --domain example.com"
|
||||
echow '-H, --help'
|
||||
echo "${EPACE}${EPACE}Display help and exit."
|
||||
exit 0
|
||||
}
|
||||
|
||||
check_input(){
|
||||
@@ -129,39 +139,381 @@ RewriteRule . /index.php [L]
|
||||
EOM
|
||||
}
|
||||
|
||||
get_theme_name(){
|
||||
THEME_NAME=$(grep WP_DEFAULT_THEME ${VH_DOC_ROOT}/wp-includes/default-constants.php | grep -v '!' | awk -F "'" '{print $4}')
|
||||
echo "${THEME_NAME}" | grep 'twenty' >/dev/null 2>&1
|
||||
if [ ${?} = 0 ]; then
|
||||
THEME="${THEME_NAME}"
|
||||
fi
|
||||
}
|
||||
|
||||
set_lscache(){
|
||||
cat << EOM > "${WP_CONST_CONF}"
|
||||
; This is the default LSCWP configuration file
|
||||
; All keys and values please refer const.cls.php
|
||||
; Here just list some examples
|
||||
;
|
||||
; This is the predefined default LSCWP configuration file
|
||||
;
|
||||
; All the keys and values please refer \`src/const.cls.php\`
|
||||
;
|
||||
; Comments start with \`;\`
|
||||
; OPID_PURGE_ON_UPGRADE
|
||||
purge_upgrade = true
|
||||
; OPID_CACHE_PRIV
|
||||
cache_priv = true
|
||||
; OPID_CACHE_COMMENTER
|
||||
cache_commenter = true
|
||||
;Object_Cache_Enable
|
||||
cache_object = true
|
||||
; OPID_CACHE_OBJECT_HOST
|
||||
;cache_object_host = 'localhost'
|
||||
cache_object_host = '/var/www/memcached.sock'
|
||||
; OPID_CACHE_OBJECT_PORT
|
||||
;cache_object_port = '11211'
|
||||
;
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- General ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
; O_AUTO_UPGRADE
|
||||
auto_upgrade = false
|
||||
; O_API_KEY
|
||||
api_key = ''
|
||||
; O_SERVER_IP
|
||||
server_ip = ''
|
||||
; O_NEWS
|
||||
news = false
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- Cache ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
cache-priv = true
|
||||
cache-commenter = true
|
||||
cache-rest = true
|
||||
cache-page_login = true
|
||||
cache-favicon = true
|
||||
cache-resources = true
|
||||
cache-browser = false
|
||||
cache-mobile = false
|
||||
cache-mobile_rules = 'Mobile
|
||||
Android
|
||||
Silk/
|
||||
Kindle
|
||||
BlackBerry
|
||||
Opera Mini
|
||||
Opera Mobi'
|
||||
cache-exc_useragents = ''
|
||||
cache-exc_cookies = ''
|
||||
cache-exc_qs = ''
|
||||
cache-exc_cat = ''
|
||||
cache-exc_tag = ''
|
||||
cache-force_uri = ''
|
||||
cache-force_pub_uri = ''
|
||||
cache-priv_uri = ''
|
||||
cache-exc = ''
|
||||
cache-exc_roles = ''
|
||||
cache-drop_qs = 'fbclid
|
||||
gclid
|
||||
utm*
|
||||
_ga'
|
||||
cache-ttl_pub = 604800
|
||||
cache-ttl_priv = 1800
|
||||
cache-ttl_frontpage = 604800
|
||||
cache-ttl_feed = 604800
|
||||
; O_CACHE_TTL_REST
|
||||
cache-ttl_rest = 604800
|
||||
cache-ttl_browser = 31557600
|
||||
cache-login_cookie = ''
|
||||
cache-vary_group = ''
|
||||
cache-ttl_status = '403 3600
|
||||
404 3600
|
||||
500 3600'
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- Purge ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
; O_PURGE_ON_UPGRADE
|
||||
purge-upgrade = true
|
||||
; O_PURGE_STALE
|
||||
purge-stale = true
|
||||
purge-post_all = false
|
||||
purge-post_f = true
|
||||
purge-post_h = true
|
||||
purge-post_p = true
|
||||
purge-post_pwrp = true
|
||||
purge-post_a = true
|
||||
purge-post_y = false
|
||||
purge-post_m = true
|
||||
purge-post_d = false
|
||||
purge-post_t = true
|
||||
purge-post_pt = true
|
||||
purge-timed_urls = ''
|
||||
purge-timed_urls_time = ''
|
||||
purge-hook_all = 'switch_theme
|
||||
wp_create_nav_menu
|
||||
wp_update_nav_menu
|
||||
wp_delete_nav_menu
|
||||
create_term
|
||||
edit_terms
|
||||
delete_term
|
||||
add_link
|
||||
edit_link
|
||||
delete_link'
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- ESI ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
; O_ESI
|
||||
esi = false
|
||||
; O_ESI_CACHE_ADMBAR
|
||||
esi-cache_admbar = true
|
||||
; O_ESI_CACHE_COMMFORM
|
||||
esi-cache_commform = true
|
||||
; O_ESI_NONCE
|
||||
esi-nonce = 'stats_nonce
|
||||
subscribe_nonce'
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- Utilities ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
util-heartbeat = true
|
||||
util-instant_click = false
|
||||
util-check_advcache = true
|
||||
util-no_https_vary = false
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- Debug ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
; O_DEBUG_DISABLE_ALL
|
||||
debug-disable_all = false
|
||||
; O_DEBUG
|
||||
debug = false
|
||||
; O_DEBUG_IPS
|
||||
debug-ips = '127.0.0.1'
|
||||
; O_DEBUG_LEVEL
|
||||
debug-level = false
|
||||
; O_DEBUG_FILESIZE
|
||||
debug-filesize = 3
|
||||
; O_DEBUG_COOKIE
|
||||
debug-cookie = false
|
||||
; O_DEBUG_COLLAPS_QS
|
||||
debug-collaps_qs = false
|
||||
; O_DEBUG_INC
|
||||
debug-inc = ''
|
||||
; O_DEBUG_EXC
|
||||
debug-exc = ''
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- DB Optm ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
; O_DB_OPTM_REVISIONS_MAX
|
||||
db_optm-revisions_max = 0
|
||||
; O_DB_OPTM_REVISIONS_AGE
|
||||
db_optm-revisions_age = 0
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- HTML Optm ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
; O_OPTM_CSS_MIN
|
||||
optm-css_min = false
|
||||
optm-css_inline_min = false
|
||||
; O_OPTM_CSS_COMB
|
||||
optm-css_comb = false
|
||||
optm-css_comb_priority = false
|
||||
; O_OPTM_CSS_HTTP2
|
||||
optm-css_http2 = false
|
||||
optm-css_exc = ''
|
||||
; O_OPTM_JS_MIN
|
||||
optm-js_min = false
|
||||
optm-js_inline_min = false
|
||||
; O_OPTM_JS_COMB
|
||||
optm-js_comb = false
|
||||
optm-js_comb_priority = false
|
||||
; O_OPTM_JS_HTTP2
|
||||
optm-js_http2 = false
|
||||
; O_OPTM_EXC_JQ
|
||||
optm-js_exc = ''
|
||||
optm-ttl = 604800
|
||||
optm-html_min = false
|
||||
optm-qs_rm = false
|
||||
optm-ggfonts_rm = false
|
||||
; O_OPTM_CSS_ASYNC
|
||||
optm-css_async = false
|
||||
; O_OPTM_CCSS_GEN
|
||||
optm-ccss_gen = true
|
||||
; O_OPTM_CCSS_ASYNC
|
||||
optm-ccss_async = true
|
||||
; O_OPTM_CSS_ASYNC_INLINE
|
||||
optm-css_async_inline = true
|
||||
; O_OPTM_CSS_FONT_DISPLAY
|
||||
optm-css_font_display = false
|
||||
; O_OPTM_JS_DEFER
|
||||
optm-js_defer = false
|
||||
; O_OPTM_JS_INLINE_DEFER
|
||||
optm-js_inline_defer = false
|
||||
optm-emoji_rm = false
|
||||
optm-exc_jq = true
|
||||
optm-ggfonts_async = false
|
||||
optm-max_size = 2
|
||||
optm-rm_comment = false
|
||||
optm-exc_roles = ''
|
||||
optm-ccss_con = ''
|
||||
optm-js_defer_exc = ''
|
||||
; O_OPTM_DNS_PREFETCH
|
||||
optm-dns_prefetch = ''
|
||||
; O_OPTM_DNS_PREFETCH_CTRL
|
||||
optm-dns_prefetch_ctrl = false
|
||||
optm-exc = ''
|
||||
; O_OPTM_CCSS_SEP_POSTTYPE
|
||||
optm-ccss_sep_posttype = ''
|
||||
; O_OPTM_CCSS_SEP_URI
|
||||
optm-ccss_sep_uri = ''
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- Object Cache ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
object = true
|
||||
object-kind = false
|
||||
;object-host = 'localhost'
|
||||
object-host = '/var/www/memcached.sock'
|
||||
;object-port = 11211
|
||||
cache_object_port = ''
|
||||
auto_upgrade = true
|
||||
; OPID_CACHE_BROWSER_TTL
|
||||
cache_browser_ttl = 2592000
|
||||
; OPID_PUBLIC_TTL
|
||||
public_ttl = 604800
|
||||
; ------------------------------CDN Mapping Example BEGIN-------------------------------
|
||||
; Need to add the section mark \`[litespeed-cache-cdn_mapping]\` before list
|
||||
object-life = 360
|
||||
object-persistent = true
|
||||
object-admin = true
|
||||
object-transients = true
|
||||
object-db_id = 0
|
||||
object-user = ''
|
||||
object-pswd = ''
|
||||
object-global_groups = 'users
|
||||
userlogins
|
||||
usermeta
|
||||
user_meta
|
||||
site-transient
|
||||
site-options
|
||||
site-lookup
|
||||
blog-lookup
|
||||
blog-details
|
||||
rss
|
||||
global-posts
|
||||
blog-id-cache'
|
||||
object-non_persistent_groups = 'comment
|
||||
counts
|
||||
plugins
|
||||
wc_session_id'
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- Discussion ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
; O_DISCUSS_AVATAR_CACHE
|
||||
discuss-avatar_cache = false
|
||||
; O_DISCUSS_AVATAR_CRON
|
||||
discuss-avatar_cron = false
|
||||
; O_DISCUSS_AVATAR_CACHE_TTL
|
||||
discuss-avatar_cache_ttl = 604800
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- Media ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
; O_MEDIA_LAZY
|
||||
media-lazy = false
|
||||
; O_MEDIA_LAZY_PLACEHOLDER
|
||||
media-lazy_placeholder = ''
|
||||
; O_MEDIA_PLACEHOLDER_RESP
|
||||
media-placeholder_resp = false
|
||||
; O_MEDIA_PLACEHOLDER_RESP_COLOR
|
||||
media-placeholder_resp_color = '#cfd4db'
|
||||
; O_MEDIA_PLACEHOLDER_RESP_GENERATOR
|
||||
media-placeholder_resp_generator = false
|
||||
; O_MEDIA_PLACEHOLDER_RESP_SVG
|
||||
media-placeholder_resp_svg = '<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" viewBox="0 0 {width} {height}"><rect width="100%" height="100%" fill="{color}"/></svg>'
|
||||
; O_MEDIA_PLACEHOLDER_LQIP
|
||||
media-placeholder_lqip = false
|
||||
; O_MEDIA_PLACEHOLDER_LQIP_QUAL
|
||||
media-placeholder_lqip_qual = 4
|
||||
; O_MEDIA_PLACEHOLDER_RESP_ASYNC
|
||||
media-placeholder_resp_async = true
|
||||
; O_MEDIA_IFRAME_LAZY
|
||||
media-iframe_lazy = false
|
||||
; O_MEDIA_LAZYJS_INLINE
|
||||
media-lazyjs_inline = false
|
||||
; O_MEDIA_LAZY_EXC
|
||||
media-lazy_exc = ''
|
||||
; O_MEDIA_LAZY_CLS_EXC
|
||||
media-lazy_cls_exc = ''
|
||||
; O_MEDIA_LAZY_PARENT_CLS_EXC
|
||||
media-lazy_parent_cls_exc = ''
|
||||
; O_MEDIA_IFRAME_LAZY_CLS_EXC
|
||||
media-iframe_lazy_cls_exc = ''
|
||||
; O_MEDIA_IFRAME_LAZY_PARENT_CLS_EXC
|
||||
media-iframe_lazy_parent_cls_exc = ''
|
||||
; O_MEDIA_LAZY_URI_EXC
|
||||
media-lazy_uri_exc = ''
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- Image Optm ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
img_optm-auto = false
|
||||
img_optm-cron = true
|
||||
img_optm-ori = true
|
||||
img_optm-rm_bkup = false
|
||||
img_optm-webp = false
|
||||
img_optm-lossless = false
|
||||
img_optm-exif = false
|
||||
img_optm-webp_replace = false
|
||||
img_optm-webp_attr = 'img.src
|
||||
div.data-thumb
|
||||
img.data-src
|
||||
div.data-large_image
|
||||
img.retina_logo_url
|
||||
div.data-parallax-image
|
||||
video.poster'
|
||||
img_optm-webp_replace_srcset = false
|
||||
img_optm-jpg_quality = 82
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- Crawler ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
crawler = false
|
||||
crawler-inc_posts = true
|
||||
crawler-inc_pages = true
|
||||
crawler-inc_cats = true
|
||||
crawler-inc_tags = true
|
||||
crawler-exc_cpt = ''
|
||||
crawler-order_links = 'date_desc'
|
||||
crawler-usleep = 500
|
||||
crawler-run_duration = 400
|
||||
crawler-run_interval = 600
|
||||
crawler-crawl_interval = 302400
|
||||
crawler-threads = 3
|
||||
crawler-timeout = 30
|
||||
crawler-load_limit = 1
|
||||
; O_CRAWLER_SITEMAP
|
||||
crawler-sitemap = ''
|
||||
; O_CRAWLER_DROP_DOMAIN
|
||||
crawler-drop_domain = true
|
||||
crawler-roles = ''
|
||||
crawler-cookies = ''
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- Misc ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
; O_MISC_HTACCESS_FRONT
|
||||
misc-htaccess_front = ''
|
||||
; O_MISC_HTACCESS_BACK
|
||||
misc-htaccess_back = ''
|
||||
; O_MISC_HEARTBEAT_FRONT
|
||||
misc-heartbeat_front = false
|
||||
; O_MISC_HEARTBEAT_FRONT_TTL
|
||||
misc-heartbeat_front_ttl = 60
|
||||
; O_MISC_HEARTBEAT_BACK
|
||||
misc-heartbeat_back = false
|
||||
; O_MISC_HEARTBEAT_BACK_TTL
|
||||
misc-heartbeat_back_ttl = 60
|
||||
; O_MISC_HEARTBEAT_EDITOR
|
||||
misc-heartbeat_editor = false
|
||||
; O_MISC_HEARTBEAT_EDITOR_TTL
|
||||
misc-heartbeat_editor_ttl = 15
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- CDN ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
cdn = false
|
||||
cdn-ori = ''
|
||||
cdn-ori_dir = ''
|
||||
cdn-exc = ''
|
||||
cdn-remote_jq = false
|
||||
cdn-quic = false
|
||||
cdn-quic_email = ''
|
||||
cdn-quic_key = ''
|
||||
cdn-cloudflare = false
|
||||
cdn-cloudflare_email = ''
|
||||
cdn-cloudflare_key = ''
|
||||
cdn-cloudflare_name = ''
|
||||
cdn-cloudflare_zone = ''
|
||||
; \`cdn-mapping\` needs to be put in the end with a section tag
|
||||
;; -------------------------------------------------- ;;
|
||||
;; -------------- CDN 2 ----------------- ;;
|
||||
;; -------------------------------------------------- ;;
|
||||
; <------------ CDN Mapping Example BEGIN -------------------->
|
||||
; Need to keep the section tag \`[cdn-mapping]\` before list.
|
||||
;
|
||||
; NOTE 1) Need to set all child options to make all resources to be replaced without missing
|
||||
; NOTE 2) \`url[n]\` option must have to enable the row setting of \`n\`
|
||||
; NOTE 1) Need to set all child options to make all resources to be replaced without missing.
|
||||
; NOTE 2) \`url[n]\` option must have to enable the row setting of \`n\`.
|
||||
; NOTE 3) This section needs to be put in the end of this .ini file
|
||||
;
|
||||
; To enable the 2nd mapping record by default, please remove the \`;;\` in the related lines
|
||||
[litespeed-cache-cdn_mapping]
|
||||
; To enable the 2nd mapping record by default, please remove the \`;;\` in the related lines.
|
||||
[cdn-mapping]
|
||||
url[0] = ''
|
||||
inc_js[0] = true
|
||||
inc_css[0] = true
|
||||
@@ -185,7 +537,7 @@ filetype[0] = '.aac
|
||||
.woff'
|
||||
;;url[1] = 'https://2nd_CDN_url.com/'
|
||||
;;filetype[1] = '.webm'
|
||||
; ------------------------------CDN Mapping Example END-------------------------------
|
||||
; <------------ CDN Mapping Example END ------------------>
|
||||
EOM
|
||||
|
||||
if [ ! -f ${VH_DOC_ROOT}/wp-content/themes/${THEME}/functions.php.bk ]; then
|
||||
@@ -261,6 +613,7 @@ main(){
|
||||
preinstall_wordpress
|
||||
install_wp_plugin
|
||||
set_htaccess
|
||||
get_theme_name
|
||||
set_lscache
|
||||
change_owner
|
||||
exit 0
|
||||
@@ -276,15 +629,15 @@ while [ ! -z "${1}" ]; do
|
||||
-[hH] | -help | --help)
|
||||
help_message
|
||||
;;
|
||||
-app | -a | -A) shift
|
||||
-[aA] | -app | --app) shift
|
||||
check_input "${1}"
|
||||
APP_NAME="${1}"
|
||||
;;
|
||||
-d | -D | -domain) shift
|
||||
-[dD] | -domain | --domain) shift
|
||||
check_input "${1}"
|
||||
DOMAIN="${1}"
|
||||
;;
|
||||
-vhname) shift
|
||||
-vhname | --vhname) shift
|
||||
VHNAME="${1}"
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -3,11 +3,22 @@ CK_RESULT=''
|
||||
LSDIR='/usr/local/lsws'
|
||||
LS_HTTPD_CONF="${LSDIR}/conf/httpd_config.xml"
|
||||
OLS_HTTPD_CONF="${LSDIR}/conf/httpd_config.conf"
|
||||
EPACE=' '
|
||||
|
||||
echow(){
|
||||
FLAG=${1}
|
||||
shift
|
||||
echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}"
|
||||
}
|
||||
|
||||
help_message(){
|
||||
echo 'Command [-add|-del] [domain_name]'
|
||||
echo 'Example 1: domainctl.sh -add example.com'
|
||||
echo 'Example 2: domainctl.sh -del example.com'
|
||||
echo -e "\033[1mOPTIONS\033[0m"
|
||||
echow '-A, --add [DOMAIN_NAME]'
|
||||
echo "${EPACE}${EPACE}Will add domain to listener and creat a virtual host from template"
|
||||
echow '-D, --del [DOMAIN_NAME]'
|
||||
echo "${EPACE}${EPACE}Will delete domain from listener"
|
||||
echow '-H, --help'
|
||||
echo "${EPACE}${EPACE}Display help."
|
||||
}
|
||||
|
||||
check_lsv(){
|
||||
@@ -61,8 +72,8 @@ www_domain(){
|
||||
}
|
||||
|
||||
add_ls_domain(){
|
||||
fst_match_line 'ccl.xml</templateFile>' ${LS_HTTPD_CONF}
|
||||
NEWNUM=$((FIRST_LINE_NUM+1))
|
||||
fst_match_line 'docker.xml</templateFile>' ${LS_HTTPD_CONF}
|
||||
NEWNUM=$((FIRST_LINE_NUM+2))
|
||||
sed -i "${NEWNUM}i \ \ \ \ \ \ <member>\n \ \ \ \ \ \ \ <vhName>${DOMAIN}</vhName>\n \ \ \ \ \ \ \ <vhDomain>${DOMAIN},${WWW_DOMAIN}</vhDomain>\n \ \ \ \ \ \ </member>" ${LS_HTTPD_CONF}
|
||||
}
|
||||
|
||||
@@ -135,10 +146,10 @@ while [ ! -z "${1}" ]; do
|
||||
-[hH] | -help | --help)
|
||||
help_message
|
||||
;;
|
||||
-add | -a | -A) shift
|
||||
-[aA] | -add | --add) shift
|
||||
add_domain ${1}
|
||||
;;
|
||||
-del | -d | -D | -delete) shift
|
||||
-[dD] | -del | --del | --delete) shift
|
||||
del_domain ${1}
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -4,11 +4,22 @@ OWASP_DIR="${LSDIR}/conf/owasp"
|
||||
RULE_FILE='modsec_includes.conf'
|
||||
LS_HTTPD_CONF="${LSDIR}/conf/httpd_config.xml"
|
||||
OLS_HTTPD_CONF="${LSDIR}/conf/httpd_config.conf"
|
||||
EPACE=' '
|
||||
|
||||
echow(){
|
||||
FLAG=${1}
|
||||
shift
|
||||
echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}"
|
||||
}
|
||||
|
||||
help_message(){
|
||||
echo 'Command [-enable|-disable]'
|
||||
echo 'Example: owaspctl.sh -enable'
|
||||
echo 'Enable mod_secure module with latest OWASP version of rules'
|
||||
echo -e "\033[1mOPTIONS\033[0m"
|
||||
echow '-E, --enable'
|
||||
echo "${EPACE}${EPACE}Will Enable mod_secure module with latest OWASP version of rules"
|
||||
echow '-D, --disable'
|
||||
echo "${EPACE}${EPACE}Will Disable mod_secure module with latest OWASP version of rules"
|
||||
echow '-H, --help'
|
||||
echo "${EPACE}${EPACE}Display help and exit."
|
||||
exit 0
|
||||
}
|
||||
|
||||
@@ -118,6 +129,7 @@ disable_ls_modesec(){
|
||||
}
|
||||
|
||||
disable_modsec(){
|
||||
check_lsv
|
||||
if [ "${LSV}" = 'lsws' ]; then
|
||||
disable_ls_modesec
|
||||
elif [ "${LSV}" = 'openlitespeed' ]; then
|
||||
@@ -195,6 +207,8 @@ main_owasp(){
|
||||
install_git
|
||||
install_owasp
|
||||
configure_owasp
|
||||
check_lsv
|
||||
enable_modsec
|
||||
}
|
||||
|
||||
check_input ${1}
|
||||
@@ -203,13 +217,10 @@ while [ ! -z "${1}" ]; do
|
||||
-[hH] | -help | --help)
|
||||
help_message
|
||||
;;
|
||||
-enable | -e | -E)
|
||||
-[eE] | -enable | --enable)
|
||||
main_owasp
|
||||
check_lsv
|
||||
enable_modsec
|
||||
;;
|
||||
-disable | -d | -D)
|
||||
check_lsv
|
||||
-[dD] | -disable | --disable)
|
||||
disable_modsec
|
||||
;;
|
||||
*)
|
||||
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#!/bin/bash
|
||||
LSDIR='/usr/local/lsws'
|
||||
EPACE=' '
|
||||
|
||||
echow(){
|
||||
FLAG=${1}
|
||||
shift
|
||||
echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}"
|
||||
}
|
||||
|
||||
help_message(){
|
||||
echo -e "\033[1mOPTIONS\033[0m"
|
||||
echow '-S, --serial [YOUR_SERIAL|TRIAL]'
|
||||
echo "${EPACE}${EPACE}Will apply and register the serial to LSWS."
|
||||
echow '-H, --help'
|
||||
echo "${EPACE}${EPACE}Display help and exit."
|
||||
exit 0
|
||||
}
|
||||
|
||||
check_input(){
|
||||
if [ -z "${1}" ]; then
|
||||
help_message
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
backup_old(){
|
||||
if [ -f ${1} ] && [ ! -f ${1}_old ]; then
|
||||
mv ${1} ${1}_old
|
||||
fi
|
||||
}
|
||||
|
||||
detect_ols(){
|
||||
if [ -e ${LSDIR}/bin/openlitespeed ]; then
|
||||
echo '[X] Detect OpenLiteSpeed, abort!'
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
apply_serial(){
|
||||
detect_ols
|
||||
check_input ${1}
|
||||
echo ${1} | grep -i 'trial' >/dev/null
|
||||
if [ ${?} = 0 ]; then
|
||||
echo 'Apply Trial License'
|
||||
if [ ! -e ${LSDIR}/conf/serial.no ] && [ ! -e ${LSDIR}/conf/license.key ]; then
|
||||
rm -f ${LSDIR}/conf/trial.key*
|
||||
wget -P ${LSDIR}/conf -q http://license.litespeedtech.com/reseller/trial.key
|
||||
echo 'Apply trial finished'
|
||||
else
|
||||
echo "Please backup and remove your existing license, apply abort!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Apply Serial number: ${1}"
|
||||
backup_old ${LSDIR}/conf/serial.no
|
||||
backup_old ${LSDIR}/conf/license.key
|
||||
backup_old ${LSDIR}/conf/trial.key
|
||||
echo "${1}" > ${LSDIR}/conf/serial.no
|
||||
${LSDIR}/bin/lshttpd -r
|
||||
if [ -f ${LSDIR}/conf/license.key ]; then
|
||||
echo '[O] Apply success'
|
||||
else
|
||||
echo '[X] Apply failed, please check!'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_input ${1}
|
||||
while [ ! -z "${1}" ]; do
|
||||
case ${1} in
|
||||
-[hH] | -help | --help)
|
||||
help_message
|
||||
;;
|
||||
-[sS] | -serial | --serial) shift
|
||||
apply_serial "${1}"
|
||||
;;
|
||||
*)
|
||||
help_message
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
+32
-15
@@ -7,13 +7,25 @@ SQL_USER=''
|
||||
SQL_PASS=''
|
||||
ANY="'%'"
|
||||
SET_OK=0
|
||||
EPACE=' '
|
||||
|
||||
echow(){
|
||||
FLAG=${1}
|
||||
shift
|
||||
echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}"
|
||||
}
|
||||
|
||||
help_message(){
|
||||
echo 'Command [-domain xxx]'
|
||||
echo 'Command [-domain xxx] [-user xxx] [-password xxx] [-database xxx]'
|
||||
echo 'Example 1: database.sh -domain example.com'
|
||||
echo 'Example 2: database.sh -domain example.com -user USERNAME -password PASSWORD -database DATABASENAME'
|
||||
echo 'Script will auto assign database & username by the domain and random password for example 1'
|
||||
echo -e "\033[1mOPTIONS\033[0m"
|
||||
echow '-D, --domain [DOMAIN_NAME]'
|
||||
echo "${EPACE}${EPACE}Example: database.sh -D example.com"
|
||||
echo "${EPACE}${EPACE}Will auto generate Database/username/password for the domain"
|
||||
echow '-D, --domain [DOMAIN_NAME] -U, --user [xxx] -P, --password [xxx] -DB, --database [xxx]'
|
||||
echo "${EPACE}${EPACE}Example: database.sh -D example.com -U USERNAME -P PASSWORD -DB DATABASENAME"
|
||||
echo "${EPACE}${EPACE}Will create Database/username/password by given"
|
||||
echow '-H, --help'
|
||||
echo "${EPACE}${EPACE}Display help and exit."
|
||||
exit 0
|
||||
}
|
||||
|
||||
check_input(){
|
||||
@@ -66,19 +78,22 @@ EOT
|
||||
fi
|
||||
}
|
||||
|
||||
add_sql_client(){
|
||||
docker-compose exec mysql su -c 'apk add mysql-client'
|
||||
}
|
||||
|
||||
check_db_access(){
|
||||
#add_sql_client
|
||||
docker-compose exec mysql su -c "mysql -uroot -p${MYSQL_ROOT_PASSWORD} -e 'status'" >/dev/null 2>&1
|
||||
if [ ${?} != 0 ]; then
|
||||
echo "DB access failed, please check!"
|
||||
echo '[X] DB access failed, please check!'
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_db_exist(){
|
||||
docker-compose exec mysql su -c "test -e /var/lib/mysql/${1}"
|
||||
if [ ${?} = 0 ]; then
|
||||
echo "Database ${1} already exist, skip DB creation!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
db_setup(){
|
||||
docker-compose exec mysql su -c 'mysql -uroot -p${MYSQL_ROOT_PASSWORD} \
|
||||
-e "CREATE DATABASE '${SQL_DB}';" \
|
||||
@@ -92,6 +107,7 @@ auto_setup_main(){
|
||||
gen_pass
|
||||
trans_name ${DOMAIN}
|
||||
auto_name
|
||||
check_db_exist ${SQL_DB}
|
||||
check_db_access
|
||||
db_setup
|
||||
display_credential
|
||||
@@ -100,6 +116,7 @@ auto_setup_main(){
|
||||
|
||||
specify_setup_main(){
|
||||
specify_name
|
||||
check_db_exist ${SQL_DB}
|
||||
check_db_access
|
||||
db_setup
|
||||
display_credential
|
||||
@@ -120,16 +137,16 @@ while [ ! -z "${1}" ]; do
|
||||
-[hH] | -help | --help)
|
||||
help_message
|
||||
;;
|
||||
-d | -D | -domain) shift
|
||||
-[dD] | -domain| --domain) shift
|
||||
DOMAIN="${1}"
|
||||
;;
|
||||
-u | -U | -user) shift
|
||||
-[uU] | -user | --user) shift
|
||||
SQL_USER="${1}"
|
||||
;;
|
||||
-p | -P | -password) shift
|
||||
-[pP] | -password| --password) shift
|
||||
SQL_PASS="'${1}'"
|
||||
;;
|
||||
-db | -DB | -database) shift
|
||||
-db | -DB | -database| --database) shift
|
||||
SQL_DB="${1}"
|
||||
;;
|
||||
*)
|
||||
|
||||
+26
-13
@@ -4,13 +4,20 @@ APP_NAME='wordpress'
|
||||
CONT_NAME='litespeed'
|
||||
DOC_FD=''
|
||||
|
||||
echow(){
|
||||
FLAG=${1}
|
||||
shift
|
||||
echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}"
|
||||
}
|
||||
|
||||
help_message(){
|
||||
case ${1} in
|
||||
"1")
|
||||
echo "Script will get 'DOMAIN' and 'database info'from .env file and install the wordpress site for you at the first time."
|
||||
echow "Script will get 'DOMAIN' and 'database' info from .env file, then auto setup virtual host and the wordpress site for you."
|
||||
exit 0
|
||||
;;
|
||||
"2")
|
||||
echo 'Service finished, enjoy your accelarated LiteSpeed server!'
|
||||
echow 'Service finished, enjoy your accelarated LiteSpeed server!'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -35,31 +42,36 @@ gen_root_fd(){
|
||||
if [ -d "./sites/${1}" ]; then
|
||||
echo -e "[O] The root folder \033[32m${DOC_FD}\033[0m exist."
|
||||
else
|
||||
echo "Creating document root..."
|
||||
echo "Creating - document root."
|
||||
bash bin/domain.sh -add ${1}
|
||||
echo "Finished document root."
|
||||
echo "Finished - document root."
|
||||
fi
|
||||
}
|
||||
|
||||
store_credential(){
|
||||
if [ -f ${DOC_FD}/.db_pass ]; then
|
||||
echo 'Back up old db file.'
|
||||
mv ${DOC_FD}/.db_pass ${DOC_FD}/.db_pass.bk
|
||||
fi
|
||||
create_db(){
|
||||
if [ ! -n "${MYSQL_DATABASE}" ] || [ ! -n "${MYSQL_USER}" ] || [ ! -n "${MYSQL_PASSWORD}" ]; then
|
||||
echo "Parameters not supplied, please check!"
|
||||
exit 1
|
||||
fi
|
||||
echo 'Storing database parameter'
|
||||
cat > "${DOC_FD}/.db_pass" << EOT
|
||||
else
|
||||
bash bin/database.sh -D ${1} -U ${MYSQL_USER} -P ${MYSQL_PASSWORD} -DB ${MYSQL_DATABASE}
|
||||
fi
|
||||
}
|
||||
|
||||
store_credential(){
|
||||
if [ -f ${DOC_FD}/.db_pass ]; then
|
||||
echo '[O] db file exist!'
|
||||
else
|
||||
echo 'Storing database parameter'
|
||||
cat > "${DOC_FD}/.db_pass" << EOT
|
||||
"Database":"${MYSQL_DATABASE}"
|
||||
"Username":"${MYSQL_USER}"
|
||||
"Password":"$(echo ${MYSQL_PASSWORD} | tr -d "'")"
|
||||
EOT
|
||||
fi
|
||||
}
|
||||
|
||||
app_download(){
|
||||
docker-compose exec ${CONT_NAME} su -c "appinstallctl.sh -app ${1} -domain ${2}"
|
||||
docker-compose exec ${CONT_NAME} su -c "appinstallctl.sh --app ${1} --domain ${2}"
|
||||
}
|
||||
|
||||
lsws_restart(){
|
||||
@@ -69,6 +81,7 @@ lsws_restart(){
|
||||
main(){
|
||||
domain_filter ${DOMAIN}
|
||||
gen_root_fd ${DOMAIN}
|
||||
create_db ${DOMAIN}
|
||||
store_credential
|
||||
app_download ${APP_NAME} ${DOMAIN}
|
||||
lsws_restart
|
||||
|
||||
+18
-7
@@ -1,10 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
CONT_NAME='litespeed'
|
||||
EPACE=' '
|
||||
|
||||
echow(){
|
||||
FLAG=${1}
|
||||
shift
|
||||
echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}"
|
||||
}
|
||||
|
||||
help_message(){
|
||||
echo 'Command [-add|-del] [domain_name]'
|
||||
echo 'Example 1: domain.sh -add example.com'
|
||||
echo 'Example 2: domain.sh -del example.com'
|
||||
echo -e "\033[1mOPTIONS\033[0m"
|
||||
echow "-A, --add [domain_name]"
|
||||
echo "${EPACE}${EPACE}Example: domain.sh -A example.com, will add the domain to Listener and auto create a new virtual host."
|
||||
echow "-D, --del [domain_name]"
|
||||
echo "${EPACE}${EPACE}Example: domain.sh -D example.com, will delete the domain from Listener."
|
||||
echow '-H, --help'
|
||||
echo "${EPACE}${EPACE}Display help and exit."
|
||||
}
|
||||
|
||||
check_input(){
|
||||
@@ -16,7 +27,7 @@ check_input(){
|
||||
|
||||
add_domain(){
|
||||
check_input ${1}
|
||||
docker-compose exec ${CONT_NAME} su -s /bin/bash lsadm -c "cd /usr/local/lsws/conf && domainctl.sh -add ${1}"
|
||||
docker-compose exec ${CONT_NAME} su -s /bin/bash lsadm -c "cd /usr/local/lsws/conf && domainctl.sh --add ${1}"
|
||||
if [ ! -d "./sites/${1}" ]; then
|
||||
mkdir -p ./sites/${1}/{html,logs,certs}
|
||||
fi
|
||||
@@ -25,7 +36,7 @@ add_domain(){
|
||||
|
||||
del_domain(){
|
||||
check_input ${1}
|
||||
docker-compose exec ${CONT_NAME} su -s /bin/bash lsadm -c "cd /usr/local/lsws/conf && domainctl.sh -del ${1}"
|
||||
docker-compose exec ${CONT_NAME} su -s /bin/bash lsadm -c "cd /usr/local/lsws/conf && domainctl.sh --del ${1}"
|
||||
bash bin/webadmin.sh -r
|
||||
}
|
||||
|
||||
@@ -35,10 +46,10 @@ while [ ! -z "${1}" ]; do
|
||||
-[hH] | -help | --help)
|
||||
help_message
|
||||
;;
|
||||
-add | -a | -A) shift
|
||||
-[aA] | -add | --add) shift
|
||||
add_domain ${1}
|
||||
;;
|
||||
-del | -d | -D | -delete) shift
|
||||
-[dD] | -del | --del | --delete) shift
|
||||
del_domain ${1}
|
||||
;;
|
||||
*)
|
||||
|
||||
+38
-16
@@ -1,17 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
CONT_NAME='litespeed'
|
||||
EPACE=' '
|
||||
|
||||
echow(){
|
||||
FLAG=${1}
|
||||
shift
|
||||
echo -e "\033[1m${EPACE}${FLAG}\033[0m${@}"
|
||||
}
|
||||
|
||||
help_message(){
|
||||
echo 'Command [PASSWORD]'
|
||||
echo 'Example: webadmin.sh mypassword'
|
||||
echo 'Command [-r]'
|
||||
echo 'Example: webadmin.sh -r'
|
||||
echo 'Will restart LiteSpeed Web Server'
|
||||
echo 'Command [-modsec] [enable|disable]'
|
||||
echo 'Example: webadmin -modsec enable'
|
||||
echo 'Command [-lsup]'
|
||||
echo 'Example: webadmin.sh -lsup'
|
||||
echo 'Will upgrade to latest stable version'
|
||||
echo -e "\033[1mOPTIONS\033[0m"
|
||||
echow '[Enter Your PASSWORD]'
|
||||
echo "${EPACE}${EPACE}Example: webadmin.sh MY_SECURE_PASS, to update web admin password immediatly."
|
||||
echow '-R, --restart'
|
||||
echo "${EPACE}${EPACE}Will gracefully restart LiteSpeed Web Server."
|
||||
echow '-M, --mod-secure [enable|disable]'
|
||||
echo "${EPACE}${EPACE}Example: webadmin.sh -M enable, will enable and apply Mod_Secure OWASP rules on server"
|
||||
echow '-U, --upgrade'
|
||||
echo "${EPACE}${EPACE}Will upgrade web server to latest stable version"
|
||||
echow '-S, --serial [YOUR_SERIAL|TRIAL]'
|
||||
echo "${EPACE}${EPACE}Will apply your serial number to LiteSpeed Web Server."
|
||||
echow '-H, --help'
|
||||
echo "${EPACE}${EPACE}Display help and exit."
|
||||
exit 0
|
||||
}
|
||||
|
||||
@@ -26,12 +36,17 @@ lsws_restart(){
|
||||
docker-compose exec ${CONT_NAME} su -c '/usr/local/lsws/bin/lswsctrl restart >/dev/null'
|
||||
}
|
||||
|
||||
apply_serial(){
|
||||
docker-compose exec ${CONT_NAME} su -c "serialctl.sh --serial ${1}"
|
||||
lsws_restart
|
||||
}
|
||||
|
||||
mod_secure(){
|
||||
if [ "${1}" = 'enable' ] || [ "${1}" = 'Enable' ]; then
|
||||
docker-compose exec ${CONT_NAME} su -s /bin/bash root -c "owaspctl.sh -enable"
|
||||
docker-compose exec ${CONT_NAME} su -s /bin/bash root -c "owaspctl.sh --enable"
|
||||
lsws_restart
|
||||
elif [ "${1}" = 'disable' ] || [ "${1}" = 'Disable' ]; then
|
||||
docker-compose exec ${CONT_NAME} su -s /bin/bash root -c "owaspctl.sh -disable"
|
||||
docker-compose exec ${CONT_NAME} su -s /bin/bash root -c "owaspctl.sh --disable"
|
||||
lsws_restart
|
||||
else
|
||||
help_message
|
||||
@@ -45,8 +60,12 @@ ls_upgrade(){
|
||||
|
||||
set_web_admin(){
|
||||
echo 'Update web admin password.'
|
||||
local LSADPATH='/usr/local/lsws/admin'
|
||||
docker-compose exec ${CONT_NAME} su -s /bin/bash lsadm -c \
|
||||
'echo "admin:$(/usr/local/lsws/admin/fcgi-bin/admin_php* -q /usr/local/lsws/admin/misc/htpasswd.php '${1}')" > /usr/local/lsws/admin/conf/htpasswd';
|
||||
'if [ -e /usr/local/lsws/admin/fcgi-bin/admin_php ]; then \
|
||||
echo "admin:$('${LSADPATH}'/fcgi-bin/admin_php -q '${LSADPATH}'/misc/htpasswd.php '${1}')" > '${LSADPATH}'/conf/htpasswd; \
|
||||
else echo "admin:$('${LSADPATH}'/fcgi-bin/admin_php5 -q '${LSADPATH}'/misc/htpasswd.php '${1}')" > '${LSADPATH}'/conf/htpasswd; \
|
||||
fi';
|
||||
}
|
||||
|
||||
main(){
|
||||
@@ -62,12 +81,15 @@ while [ ! -z "${1}" ]; do
|
||||
-[rR] | -restart | --restart)
|
||||
lsws_restart
|
||||
;;
|
||||
-modsec | -sec| --sec) shift
|
||||
-M | -mode-secure | --mod-secure) shift
|
||||
mod_secure ${1}
|
||||
;;
|
||||
-lsup | -upgrade) shift
|
||||
-lsup | --lsup | --upgrade | -U) shift
|
||||
ls_upgrade
|
||||
;;
|
||||
;;
|
||||
-[sS] | -serial | --serial) shift
|
||||
apply_serial ${1}
|
||||
;;
|
||||
*)
|
||||
main ${1}
|
||||
;;
|
||||
|
||||
+3
-2
@@ -13,7 +13,7 @@ services:
|
||||
MYSQL_USER: ${MYSQL_USER}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||||
litespeed:
|
||||
image: litespeedtech/openlitespeed-beta:${OLS_VERSION}-${PHP_VERSION}
|
||||
image: litespeedtech/openlitespeed:${OLS_VERSION}-${PHP_VERSION}
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
@@ -32,7 +32,8 @@ services:
|
||||
environment:
|
||||
TZ: ${TimeZone}
|
||||
phpmyadmin:
|
||||
image: bitnami/phpmyadmin:latest
|
||||
#image: bitnami/phpmyadmin:latest
|
||||
image: bitnami/phpmyadmin:5.0.2-debian-10-r72
|
||||
ports:
|
||||
- 8080:80
|
||||
- 8443:443
|
||||
|
||||
Reference in New Issue
Block a user