From 93932618aacb834a0eda299ed03fcc6cd1d02253 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Sun, 11 Jul 2021 18:54:21 +0700 Subject: [PATCH 01/20] New README 3.x.x --- README.md | 88 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 71 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 8cecf8fb..ec7bf3cd 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,28 @@ # [L]inux [E]ngine-X [M]ariaDB [P]HP Install[ER] +

+

+

+ +

+LEMPer version +GitHub forks +GitHub issues +GitHub stars +GitHub CI +GitHub license +

+ +

LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in Bash script. This is just a small tool set (a bunch collection of scripts) that usually I use to deploy and manage LEMP stack on Debian/Ubuntu. LEMPer is _CloudWays_, _Ploi_, _RunCloud_, and _ServerPilot_ free alternative crafted to support wide-range PHP framework (not only WordPress). - -[![Build Status](https://api.travis-ci.com/joglomedia/LEMPer.svg?branch=2.0.x)](https://travis-ci.com/github/joglomedia/LEMPer) +

## Features @@ -40,33 +60,33 @@ LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in * Make a copy of .env.dist to .env ```cp .env.dist .env``` and replace the values. * Execute install.sh file, ```sudo ./install.sh```. -### Install LEMPer stack +### Install LEMPer Stack ```bash sudo apt install git && git clone -q https://github.com/joglomedia/LEMPer.git && cd LEMPer && cp -f .env.dist .env && sudo ./install.sh ``` -### Remove LEMPer stack +### Remove LEMPer Stack ```bash sudo ./remove.sh ``` -## LEMPer Command Line Administration Tool +### LEMPer Command Line Administration Tool LEMPer comes with friendly command line tool which will make your LEMP stack administration much easier. These command line tool called Lemper CLI (lemper-cli) for creating new virtual host and managing existing LEMP stack. -### LEMPer CLI Usage +#### LEMPer CLI Usage Here are some examples of using LEMPer CLI. -#### LEMPer CLI add new vhost / website +##### LEMPer CLI add new vhost / website ```bash sudo lemper-cli create -u username -d example.app -f default -w /home/username/Webs/example.app ``` -#### LEMPer CLI manage vhost / website +##### LEMPer CLI manage vhost / website Example, enable SSL @@ -80,7 +100,7 @@ Example, enable FastCGI cache sudo lemper-cli manage --enable-fastcgi-cache example.app ``` -#### for more help +##### for more help ```bash sudo lemper-cli --help @@ -88,7 +108,7 @@ sudo lemper-cli --help Note: Lemper CLI will automagically add a new PHP-FPM user's pool configuration if it doesn't exists. You must add the user account first. -## Web-based Administration +### Web-based Administration You can access pre-installed web-based administration tools here @@ -108,7 +128,7 @@ TinyFilemanage (Web-based file managemer) http://YOUR_DOMAIN_NAME:8082/lcp/filemanager ``` -## TODO +## TODOs * ~~Custom build latest [Nginx](https://nginx.org/en/) from source~~ * ~~Add [Let's Encrypt SSL](https://letsencrypt.org/)~~ @@ -120,6 +140,10 @@ http://YOUR_DOMAIN_NAME:8082/lcp/filemanager * Add user account & hosting package management. * Add your feature [request here](https://github.com/joglomedia/LEMPer/issues/new). +## Security Vulnerabilities and Bugs + +If you discover any security vulnerability or any bug within _EasyDock Linux_, please open an issue. + ## Contributing * Fork it ([https://github.com/joglomedia/LEMPer/fork](https://github.com/joglomedia/LEMPer/fork)) @@ -127,20 +151,50 @@ http://YOUR_DOMAIN_NAME:8082/lcp/filemanager * Commit your changes (git commit -am 'Add some feature') or (git commit -am 'Fix some issue') * Push to the branch (git push origin my-new-feature) or (git push origin fix-some-issue) * Create a new Pull Request -* Travis unit tests will be run to make sure that your changes does not have errors or warning +* GitHub Workflows will be run to make sure that your changes does not have errors or warning + +## Awesome People + +**LEMPer Stack** is an open-source project licensed under the GNU GPLv3 license with its ongoing development made possible entirely by the support of all these smart and generous people, from code contributors to financial contributors. :purple_heart: + +Thank you for considering contributing to this project! -## TL;DR +### Project Maintainers -If you're looking for mature, feature rich, advanced services with 24/7 premium support, please don't use this script. + + + + + + +
+ +
+ Edi Septriyanto +
+ @joglomedia +
-## DONATION +### Code Contributors + + + + + +Made with [contributors-img](https://contrib.rocks). + +### Financial Contributors + +You can support us using any of the methods below: **[Buy Me a Bottle of Milk or a Cup of Coffee](https://paypal.me/masedi) !!** -## SPONSORSHIP +## Licence -Be the first one! +LEMPer stack is open-source project licensed under the GNU GPLv3 license. ## Copyright (c) 2014-2021 | [MasEDI.Net](https://masedi.net/) + +### Enjoy LEMPer stack ;) From 5dbb08110f60a8255f33c009f3818a2aec437088 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Sun, 11 Jul 2021 18:54:47 +0700 Subject: [PATCH 02/20] Add GitHUB Workflows CI --- .github/workflows/main.yml | 81 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..cf75a2a0 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,81 @@ +# This is a basic workflow to help you get started with Actions + +name: lemper-stack + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: + - '*' # matches every branch that doesn't contain a '/' + - '*/*' # matches every branch containing a single '/' + - '**' # matches every branch +# - '!master' # excludes master + pull_request: + branches: + - master + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - uses: php-actions/composer@v5 + + # Prepare your + - name: Prepare testing env variables + run: | + cp .env.dist .env + sed -i "s/ENVIRONMENT=\"production\"/ENVIRONMENT=\"development\"/g" .env + sed -i "s/SERVER_HOSTNAME=\"\"/SERVER_HOSTNAME=\"travis-ci.masedi.net\"/g" .env + sed -i "s/SERVER_IP=\"\"/SERVER_IP=\"127.0.0.1\"/g" .env + sed -i "s/AUTO_INSTALL=false/AUTO_INSTALL=true/g" .env + sed -i "s/AUTO_REMOVE=false/AUTO_REMOVE=true/g" .env + sed -i "s/FORCE_REMOVE=false/FORCE_REMOVE=true/g" .env + sed -i "s/ADMIN_EMAIL=\"mail@example.com\"/ADMIN_EMAIL=\"me@masedi.net\"/g" .env + sed -i "s/PHP_VERSION=\"7.4\"/PHP_VERSION=\"7.4\"/g" .env + sed -i "s/PHP_LOADER=\"none\"/PHP_LOADER=\"ioncube\"/g" .env + sed -i "s/PHP_IMAGEMAGICK_INSTALLER=\"repo\"/PHP_IMAGEMAGICK_INSTALLER=\"source\"/g" .env + sed -i "s/INSTALL_MAILER=true/INSTALL_MAILER=false/g" .env + sed -i "s/INSTALL_SPFDKIM=true/INSTALL_SPFDKIM=false/g" .env + sed -i "s/SENDER_DOMAIN=\"example.com\"/SENDER_DOMAIN=\"localhost.localhost\"/g" .env + sed -i "s/INSTALL_FAIL2BAN=false/INSTALL_FAIL2BAN=true/g" .env + + # Install LEMPer dependencies + - name: Run install testing dependencies + run: | + sudo apt-get update -qq -y + sudo apt-get install -qq -y bash shellcheck + sudo bash scripts/cleanup_server.sh + sudo bash scripts/install_dependencies.sh + + # Shellcheck + - name: Run shellcheck testing + env: + TERM: xterm-256color + run: | + shellcheck -s bash -x install.sh + shellcheck -s bash -x remove.sh + shellcheck -s bash -x lib/lemper-*.sh + shellcheck -s bash -x scripts/cleanup_server.sh + shellcheck -s bash -x scripts/helper.sh + shellcheck -s bash -x scripts/install_*.sh + shellcheck -s bash -x scripts/remove_*.sh + shellcheck -s bash -x scripts/secure_server.sh + + # Simple unit testing + - name: Run unit testing + env: + TERM: xterm-256color + run: + sudo bash shunit2/run_test.sh From bb9c54fbcfaf38a0ec86b34f2a203006d0d3b4b9 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Sun, 11 Jul 2021 18:57:57 +0700 Subject: [PATCH 03/20] Update GitHUB Workflows CI --- .github/workflows/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cf75a2a0..f4ffb925 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,8 +30,6 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - - uses: php-actions/composer@v5 - # Prepare your - name: Prepare testing env variables run: | From 1d1ca0b9a9504494df60c15d65662fb5efb4a6e1 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Sun, 11 Jul 2021 20:25:29 +0700 Subject: [PATCH 04/20] New README 3.x.x --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ec7bf3cd..241177ae 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,27 @@ # [L]inux [E]ngine-X [M]ariaDB [P]HP Install[ER]

-

+

LEMPer version +GitHub stars GitHub forks GitHub issues -GitHub stars GitHub CI GitHub license

-LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in Bash script. This is just a small tool set (a bunch collection of scripts) that usually I use to deploy and manage LEMP stack on Debian/Ubuntu. LEMPer is _CloudWays_, _Ploi_, _RunCloud_, and _ServerPilot_ free alternative crafted to support wide-range PHP framework (not only WordPress). +LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in Bash script. This is just a small tool set (a bunch collection of scripts) that usually I use to deploy and manage LEMP stack on Debian/Ubuntu. LEMPer is CloudWays, Ploi, RunCloud, and ServerPilot free alternative crafted to support wide-range PHP framework & CMS.

## Features @@ -197,4 +197,4 @@ LEMPer stack is open-source project licensed under the GNU GPLv3 license. (c) 2014-2021 | [MasEDI.Net](https://masedi.net/) -### Enjoy LEMPer stack ;) +### Enjoy LEMPer Stack ;) From 2db8cef0e0352e43f8eae7b0621e629d35b3935c Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Sun, 11 Jul 2021 20:25:54 +0700 Subject: [PATCH 05/20] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9ed518db..99451824 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .env .env.save +.travis.yml lemper.log lemper.sh scripts/install_ffmpeg.sh From 31d5408453b83d516c4c7aaf1fc64566a22df738 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Sun, 11 Jul 2021 20:59:38 +0700 Subject: [PATCH 06/20] Update GitHUB Workflows CI --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f4ffb925..17ca557b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,8 +54,6 @@ jobs: run: | sudo apt-get update -qq -y sudo apt-get install -qq -y bash shellcheck - sudo bash scripts/cleanup_server.sh - sudo bash scripts/install_dependencies.sh # Shellcheck - name: Run shellcheck testing @@ -75,5 +73,7 @@ jobs: - name: Run unit testing env: TERM: xterm-256color - run: + run: | + sudo bash scripts/cleanup_server.sh + sudo bash scripts/install_dependencies.sh sudo bash shunit2/run_test.sh From 9ad10dc13a40cbc071c55d52efbeb25e3c2825e6 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Sun, 11 Jul 2021 21:00:32 +0700 Subject: [PATCH 07/20] Rename Nginx JS module var --- .env.dist | 2 +- scripts/install_nginx.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.env.dist b/.env.dist index b526200e..18056073 100644 --- a/.env.dist +++ b/.env.dist @@ -123,7 +123,7 @@ NGX_HTTP_LUA=false NGX_HTTP_MEMCACHED=false NGX_HTTP_NAXSI=false NGX_HTTP_NDK=false -NGX_HTTP_NJS=false +NGX_HTTP_JS=false NGX_HTTP_PASSENGER=false NGX_HTTP_REDIS2=false NGX_HTTP_SUBS_FILTER=true diff --git a/scripts/install_nginx.sh b/scripts/install_nginx.sh index e8be4aeb..aac30fa8 100755 --- a/scripts/install_nginx.sh +++ b/scripts/install_nginx.sh @@ -199,8 +199,8 @@ function init_nginx_install() { EXTRA_MODULE_PKGS=("${EXTRA_MODULE_PKGS[@]}" "libnginx-mod-http-ndk") fi - # NGX_HTTP_NJS is a subset of the JavaScript language that allows extending nginx functionality. - if "${NGX_HTTP_NJS}"; then + # NJS is a subset of the JavaScript language that allows extending nginx functionality. + if "${NGX_HTTP_JS}"; then echo "Adding ngx-http-js module..." #EXTRA_MODULE_PKGS=("${EXTRA_MODULE_PKGS[@]}" "libnginx-mod-js") fi @@ -801,8 +801,8 @@ function init_nginx_install() { fi fi - # NGX_HTTP_NJS is a subset of the JavaScript language that allows extending nginx functionality. - if "${NGX_HTTP_NJS}"; then + # NJS is a subset of the JavaScript language that allows extending nginx functionality. + if "${NGX_HTTP_JS}"; then echo "Adding ngx-http-js module..." run git clone https://github.com/nginx/njs.git if "${NGINX_DYNAMIC_MODULE}"; then From dd6bbfa202d28bb5b34d39a81dbb6ac276640ab0 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Sun, 11 Jul 2021 21:01:12 +0700 Subject: [PATCH 08/20] New script update --- scripts/install_phploader.sh | 127 +++++------------------------------ 1 file changed, 17 insertions(+), 110 deletions(-) diff --git a/scripts/install_phploader.sh b/scripts/install_phploader.sh index eb234e89..4d11b911 100755 --- a/scripts/install_phploader.sh +++ b/scripts/install_phploader.sh @@ -279,8 +279,7 @@ function remove_sourceguardian() { # Initialize PHP Loader Installation. # function init_phploader_install() { - local SELECTED_PHP="" - local SELECTED_PHPLOADER="" + local SELECTED_PHP_LOADER="" OPTS=$(getopt -o p:l:ir \ -l php-version:,php-loader:,install,remove \ @@ -327,118 +326,26 @@ function init_phploader_install() { PHP_LOADER=${PHP_LOADER:-""} fi - if "${AUTO_INSTALL}"; then - # PHP Loader. - if [[ -z "${PHP_LOADER}" || "${PHP_LOADER}" == "none" ]]; then - DO_INSTALL_PHPLOADER="n" - else - DO_INSTALL_PHPLOADER="y" - SELECTED_PHPLOADER=${PHP_LOADER} - fi - else - while [[ "${DO_INSTALL_PHPLOADER}" != "y" && "${DO_INSTALL_PHPLOADER}" != "n" ]]; do - read -rp "Do you want to install PHP Loader? [y/n]: " -e DO_INSTALL_PHPLOADER - done - fi - - if [[ ${DO_INSTALL_PHPLOADER} == y* && ${INSTALL_PHP_LOADER} == true ]]; then - # Select loader. - if ! "${AUTO_INSTALL}"; then - echo "" - echo "Available PHP Loaders:" - echo " 1). ionCube Loader (latest stable)" - echo " 2). SourceGuardian (latest stable)" - echo " 3). All loaders (ionCube, SourceGuardian)" - echo "--------------------------------------------" - - while [[ ${SELECTED_PHPLOADER} != "1" && ${SELECTED_PHPLOADER} != "2" && \ - ${SELECTED_PHPLOADER} != "3" && ${SELECTED_PHPLOADER} != "ioncube" && \ - ${SELECTED_PHPLOADER} != "sg" && ${SELECTED_PHPLOADER} != "ic" && \ - ${SELECTED_PHPLOADER} != "sourceguardian" && ${SELECTED_PHPLOADER} != "all" ]]; do - read -rp "Select PHP loader or an option [1-3]: " -i "${PHP_LOADER}" -e SELECTED_PHPLOADER - done - fi - - # Select PHP version. - if "${AUTO_INSTALL}"; then - if [ -z "${SELECTED_PHP}" ]; then - SELECTED_PHP=${PHP_VERSION:-"7.3"} - fi - else - echo "" - echo "Which PHP to install the Loader?" - echo "Supported PHP versions:" - echo " 1). PHP 5.6 (EOL)" - echo " 2). PHP 7.0 (EOL)" - echo " 3). PHP 7.1 (SFO)" - echo " 4). PHP 7.2 (Stable)" - echo " 5). PHP 7.3 (Stable)" - echo " 6). PHP 7.4 (Latest stable)" - echo " 7). All available versions" - echo "+--------------------------------------+" - - while [[ ${SELECTED_PHP} != "1" && ${SELECTED_PHP} != "2" && ${SELECTED_PHP} != "3" && \ - ${SELECTED_PHP} != "4" && ${SELECTED_PHP} != "5" && ${SELECTED_PHP} != "6" && \ - ${SELECTED_PHP} != "7" && ${SELECTED_PHP} != "5.6" && ${SELECTED_PHP} != "7.0" && \ - ${SELECTED_PHP} != "7.1" && ${SELECTED_PHP} != "7.2" && ${SELECTED_PHP} != "7.3" && \ - ${SELECTED_PHP} != "7.4" && ${SELECTED_PHP} != "all" ]]; do - read -rp "Select a PHP version or an option [1-7]: " -i "${PHP_VERSION}" -e SELECTED_PHP - done - fi - - local PHPv - case ${SELECTED_PHP} in - 1|"5.6") - PHPv="5.6" - ;; - 2|"7.0") - PHPv="7.0" - ;; - 3|"7.1") - PHPv="7.1" - ;; - 4|"7.2") - PHPv="7.2" - ;; - 5|"7.3") - PHPv="7.3" - ;; - 6|"7.4") - PHPv="7.4" - ;; - 7|"all") - # Install all PHP version (except EOL & Beta). - PHPv="all" - ;; - *) - PHPv="unsupported" - error "Your selected PHP version ${SELECTED_PHP} is not supported." - ;; - esac - fi - - # NOT COMPLETE - # Install PHP loader. if [[ "${PHPv}" != "unsupported" && ! $(version_older_than "${PHPv}" "5.6") ]]; then if "${AUTO_INSTALL}"; then # PHP Loader. - if [ -z "${SELECTED_PHPLOADER}" ]; then - SELECTED_PHPLOADER=${PHP_LOADER:-""} + if [ -z "${SELECTED_PHP_LOADER}" ]; then + SELECTED_PHP_LOADER=${PHP_LOADER:-""} fi - if [[ -z "${SELECTED_PHPLOADER}" || "${SELECTED_PHPLOADER}" == "none" ]]; then - INSTALL_PHPLOADER="n" + if [[ -z "${SELECTED_PHP_LOADER}" || "${SELECTED_PHP_LOADER}" == "none" ]]; then + DO_INSTALL_PHP_LOADER="n" else - INSTALL_PHPLOADER="y" + DO_INSTALL_PHP_LOADER="y" fi else - while [[ "${INSTALL_PHPLOADER}" != "y" && "${INSTALL_PHPLOADER}" != "n" ]]; do - read -rp "Do you want to install PHP Loader? [y/n]: " -i n -e INSTALL_PHPLOADER + while [[ "${DO_INSTALL_PHP_LOADER}" != "y" && "${DO_INSTALL_PHP_LOADER}" != "n" ]]; do + read -rp "Do you want to install PHP Loader? [y/n]: " -i n -e DO_INSTALL_PHP_LOADER done fi - if [[ ${INSTALL_PHPLOADER} == Y* || ${INSTALL_PHPLOADER} == y* ]]; then + if [[ ${DO_INSTALL_PHP_LOADER} == y* && ${INSTALL_PHP_LOADER} == true ]]; then if ! "${AUTO_INSTALL}"; then echo "" echo "Available PHP Loaders:" @@ -447,11 +354,11 @@ function init_phploader_install() { echo " 3). All loaders (ionCube, SourceGuardian)" echo "--------------------------------------------" - while [[ ${SELECTED_PHPLOADER} != "1" && ${SELECTED_PHPLOADER} != "2" && \ - ${SELECTED_PHPLOADER} != "3" && ${SELECTED_PHPLOADER} != "ioncube" && \ - ${SELECTED_PHPLOADER} != "sg" && ${SELECTED_PHPLOADER} != "ic" && \ - ${SELECTED_PHPLOADER} != "sourceguardian" && ${SELECTED_PHPLOADER} != "all" ]]; do - read -rp "Select an option [1-3]: " -i "${PHP_LOADER}" -e SELECTED_PHPLOADER + while [[ ${SELECTED_PHP_LOADER} != "1" && ${SELECTED_PHP_LOADER} != "2" && \ + ${SELECTED_PHP_LOADER} != "3" && ${SELECTED_PHP_LOADER} != "ioncube" && \ + ${SELECTED_PHP_LOADER} != "sg" && ${SELECTED_PHP_LOADER} != "ic" && \ + ${SELECTED_PHP_LOADER} != "sourceguardian" && ${SELECTED_PHP_LOADER} != "all" ]]; do + read -rp "Select an option [1-3]: " -i "${PHP_LOADER}" -e SELECTED_PHP_LOADER done fi @@ -460,7 +367,7 @@ function init_phploader_install() { run mkdir -p /usr/lib/php/loaders fi - case ${SELECTED_PHPLOADER} in + case ${SELECTED_PHP_LOADER} in 1|"ic"|"ioncube") install_ioncube @@ -549,11 +456,11 @@ function init_phploader_install() { fi ;; *) - info "Your selected PHP loader ${SELECTED_PHPLOADER} is not supported yet." + info "Your selected PHP loader ${SELECTED_PHP_LOADER} is not supported yet." ;; esac else - info "${SELECTED_PHPLOADER^} PHP ${PHPv} loader installation skipped." + info "${SELECTED_PHP_LOADER^} PHP ${PHPv} loader installation skipped." fi fi } From 6a2c31fbc1ff8330b67a0b1450650c3f3765775e Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Sun, 11 Jul 2021 21:27:31 +0700 Subject: [PATCH 09/20] Fix shunit2 test --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 17ca557b..f8bc386e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -53,8 +53,10 @@ jobs: - name: Run install testing dependencies run: | sudo apt-get update -qq -y - sudo apt-get install -qq -y bash shellcheck - + sudo apt-get install -qq -y bash curl shellcheck + sudo curl -s -o /usr/local/bin/shunit2 https://raw.githubusercontent.com/kward/shunit2/master/shunit2 + sudo chmod a+x /usr/local/bin/shunit2 + # Shellcheck - name: Run shellcheck testing env: From 0bd20e1e982df7e7acb2a404ee0290220ce45615 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Sun, 11 Jul 2021 21:42:48 +0700 Subject: [PATCH 10/20] Fix shunit2 test --- .github/workflows/main.yml | 3 ++- shunit2/run_test.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f8bc386e..ff9a66f5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -42,6 +42,7 @@ jobs: sed -i "s/FORCE_REMOVE=false/FORCE_REMOVE=true/g" .env sed -i "s/ADMIN_EMAIL=\"mail@example.com\"/ADMIN_EMAIL=\"me@masedi.net\"/g" .env sed -i "s/PHP_VERSION=\"7.4\"/PHP_VERSION=\"7.4\"/g" .env + sed -i "s/INSTALL_PHP_LOADER=false/INSTALL_PHP_LOADER=true/g" .env sed -i "s/PHP_LOADER=\"none\"/PHP_LOADER=\"ioncube\"/g" .env sed -i "s/PHP_IMAGEMAGICK_INSTALLER=\"repo\"/PHP_IMAGEMAGICK_INSTALLER=\"source\"/g" .env sed -i "s/INSTALL_MAILER=true/INSTALL_MAILER=false/g" .env diff --git a/shunit2/run_test.sh b/shunit2/run_test.sh index 517b659f..2531a6df 100755 --- a/shunit2/run_test.sh +++ b/shunit2/run_test.sh @@ -28,7 +28,7 @@ testEqualityGetDistribName() testEqualityGetReleaseName() { release_name=$(get_release_name) - assertEquals "bionic" "${release_name}" + assertEquals "focal" "${release_name}" } testEqualityCreateAccount() From edcbb8ff16f97cde1515a37624981ada6ceddf98 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Mon, 12 Jul 2021 22:21:29 +0700 Subject: [PATCH 11/20] Move Nginx compression to per vhost conf --- .../compression_brotli.conf} | 0 .../compression_gzip.conf} | 0 etc/nginx/nginx.conf | 2 +- lib/lemper-create.sh | 148 ++++++--- lib/lemper-manage.sh | 295 ++++++++++-------- 5 files changed, 275 insertions(+), 170 deletions(-) rename etc/nginx/{comp_brotli => includes/compression_brotli.conf} (100%) rename etc/nginx/{comp_gzip => includes/compression_gzip.conf} (100%) diff --git a/etc/nginx/comp_brotli b/etc/nginx/includes/compression_brotli.conf similarity index 100% rename from etc/nginx/comp_brotli rename to etc/nginx/includes/compression_brotli.conf diff --git a/etc/nginx/comp_gzip b/etc/nginx/includes/compression_gzip.conf similarity index 100% rename from etc/nginx/comp_gzip rename to etc/nginx/includes/compression_gzip.conf diff --git a/etc/nginx/nginx.conf b/etc/nginx/nginx.conf index 08647afa..501fa38b 100644 --- a/etc/nginx/nginx.conf +++ b/etc/nginx/nginx.conf @@ -75,7 +75,7 @@ http { # Enable Compression. # gzip (default) or brotli (requires Nginx installed with brotli module). - include /etc/nginx/comp_gzip; + #include /etc/nginx/comp_gzip; # Uncomment to enable FastCGI cache. If disabled, do not use the cached vhost setting. include /etc/nginx/fastcgi_cache; diff --git a/lib/lemper-create.sh b/lib/lemper-create.sh index 8078bed2..19f8a288 100755 --- a/lib/lemper-create.sh +++ b/lib/lemper-create.sh @@ -118,7 +118,7 @@ fi function show_usage { cat <<- _EOF_ ${APP_NAME^} ${APP_VERSION} -Creates Nginx virtual host (vHost) configuration file. +Creates NGINX virtual host (vHost) configuration file. Requirements: * LEMP stack setup uses [LEMPer](https://github.com/joglomedia/LEMPer) @@ -157,7 +157,7 @@ Options: -s, --enable-ssl Enable HTTPS with Let's Encrypt free SSL certificate. -P, --enable-pagespeed - Enable Nginx mod_pagespeed. + Enable NGINX mod_pagespeed. -W, --wildcard-domain Enable wildcard (*) domain. @@ -203,7 +203,11 @@ server { root \$root_path; index index.php index.html index.htm; - ## Uncomment to enable Mod PageSpeed (Nginx must be installed with mod PageSpeed). + # Enable Compression. + # gzip (default) or brotli (requires NGINX installed with brotli module). + #include /etc/nginx/includes/compression_gzip.conf; + + ## Uncomment to enable Mod PageSpeed (NGINX must be installed with mod PageSpeed). #include /etc/nginx/includes/mod_pagespeed.conf; # Authorizing domain. @@ -318,7 +322,11 @@ server { root \$root_path; index index.php index.html index.htm; - ## Uncomment to enable Mod PageSpeed (Nginx must be installed with mod PageSpeed). + # Enable Compression. + # gzip (default) or brotli (requires NGINX installed with brotli module). + #include /etc/nginx/includes/compression_gzip.conf; + + ## Uncomment to enable Mod PageSpeed (NGINX must be installed with mod PageSpeed). #include /etc/nginx/includes/mod_pagespeed.conf; # Authorizing domain. @@ -352,7 +360,7 @@ server { ## Default vhost directives configuration. #include /etc/nginx/includes/rules_fastcgi_cache.conf; - include /etc/nginx/vhost/site_${FRAMEWORK}.conf; + include /etc/nginx/vhost/site_drupal.conf; ## Add your custom site directives here. @@ -427,7 +435,11 @@ server { root \$root_path; index index.php index.html index.htm; - ## Uncomment to enable Mod PageSpeed (Nginx must be installed with mod PageSpeed). + # Enable Compression. + # gzip (default) or brotli (requires NGINX installed with brotli module). + #include /etc/nginx/includes/compression_gzip.conf; + + ## Uncomment to enable Mod PageSpeed (NGINX must be installed with mod PageSpeed). #include /etc/nginx/includes/mod_pagespeed.conf; # Authorizing domain. @@ -462,7 +474,7 @@ server { ## Default vhost directives configuration. #include /etc/nginx/includes/rules_fastcgi_cache.conf; - include /etc/nginx/vhost/site_${FRAMEWORK}.conf; + include /etc/nginx/vhost/site_laravel.conf; ## Add your custom site directives here. @@ -537,7 +549,11 @@ server { root \$root_path; index index.php index.html index.htm; - ## Uncomment to enable Mod PageSpeed (Nginx must be installed with mod PageSpeed). + # Enable Compression. + # gzip (default) or brotli (requires NGINX installed with brotli module). + #include /etc/nginx/includes/compression_gzip.conf; + + ## Uncomment to enable Mod PageSpeed (NGINX must be installed with mod PageSpeed). #include /etc/nginx/includes/mod_pagespeed.conf; # Authorizing domain. @@ -572,7 +588,7 @@ server { ## Default vhost directives configuration. #include /etc/nginx/includes/rules_fastcgi_cache.conf; - include /etc/nginx/vhost/site_${FRAMEWORK}.conf; + include /etc/nginx/vhost/site_phalcon.conf; ## Add your custom site directives here. @@ -627,7 +643,7 @@ _EOF_ # function prepare_vhost_wpms() { cat <<- _EOF_ -# Wordpress Multisite Mapping for Nginx (Requires Nginx Helper plugin). +# Wordpress Multisite Mapping for NGINX (Requires NGINX Helper plugin). map \$http_host \$blogid { default 0; include ${WEBROOT}/wp-content/uploads/nginx-helper/[map].conf; @@ -756,7 +772,7 @@ security.limit_extensions = .php .php${PHP_VERSION//./} ; Custom PHP ini settings. php_flag[display_errors] = On -;php_admin_value[error_reporting] = E_ALL & ~E_DEPRECATED & ~E_STRICT +;php_admin_value[error_reporting] = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING & ~E_NOTICE ;php_admin_value[disable_functions] = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,exec,passthru,popen,proc_open,shell_exec,system php_admin_flag[log_errors] = On php_admin_value[error_log] = /var/log/php/php${PHP_VERSION}-fpm.\$pool.log @@ -819,7 +835,7 @@ function install_wordpress() { fi # Get default favicon. - #run wget -q -O "${WEBROOT}/favicon.ico" https://github.com/joglomedia/LEMPer/raw/master/favicon.ico + #run wget -q -O "${WEBROOT}/favicon.ico" https://github.com/joglomedia/LEMPer/raw/master/.github/assets/favicon.ico run chown -hR "${USERNAME}:${USERNAME}" "${WEBROOT}" } @@ -992,7 +1008,7 @@ function init_app() { if [ ${MAIN_ARGS} -ge 1 ]; then # Additional Check - ensure that Nginx's configuration meets the requirements. if [[ ! -d /etc/nginx/sites-available && ! -d /etc/nginx/vhost ]]; then - fail "It seems that your Nginx installation doesn't meet LEMPer requirements. Aborting..." + fail "It seems that your NGINX installation doesn't meet LEMPer requirements. Aborting..." fi # Check domain parameter. @@ -1060,7 +1076,7 @@ function init_app() { success "New php${PHP_VERSION}-fpm pool [${USERNAME}] has been created." fi else - fail "Oops, PHP ${PHP_VERSION} & FPM not found. Please install it first! Aborting..." + fail "Oops, PHP ${PHP_VERSION} runtime not found. Please install it first! Aborting..." fi # Check web root parameter. @@ -1088,12 +1104,57 @@ function init_app() { # Ugly hacks for custom framework-specific configs + Skeleton auto installer. case "${FRAMEWORK}" in + codeigniter) + echo "Setting up CodeIgniter framework virtual host..." + + # Clone CodeIgniter skeleton files. + if [[ ${INSTALL_APP} == true ]]; then + # Checking CodeIgniter installation. + if [ ! -f "${WEBROOT}/spark" ]; then + echo "Downloading CodeIgniter v4 skeleton files..." + + if [[ -n "${PHP_COMPOSER_BIN}" ]]; then + run "${PHP_BIN}" "${PHP_COMPOSER_BIN}" create-project --prefer-source codeigniter4/appstarter "${WEBROOT}" + else + run git clone -q --depth=1 --branch=master \ + "https://github.com/codeigniter4/appstarter.git" "${WEBROOT}" || \ + error "Something went wrong while downloading CodeIgniter v4 files." + fi + else + info "It seems that CodeIgniter v4 skeleton files already exists." + fi + else + # Create default index file. + if [ ! -e "${WEBROOT}/public/index.php" ]; then + echo "Creating default index file..." + run mkdir -p "${WEBROOT}/public" + create_index_file > "${WEBROOT}/public/index.html" + fi + fi + + # Well-Known URIs: RFC 8615. + if [ ! -d "${WEBROOT}/public/.well-known" ]; then + run mkdir -p "${WEBROOT}/public/.well-known" + fi + + #run wget -q -O "${WEBROOT}/public/favicon.ico" \ + # https://github.com/joglomedia/LEMPer/raw/master/.github/assets/favicon.ico + + # Fix ownership. + run chown -hR "${USERNAME}:${USERNAME}" "${WEBROOT}" + + # Create vhost. + echo "Creating virtual host file: ${VHOST_FILE}..." + + create_vhost_laravel > "${VHOST_FILE}" + ;; + drupal) echo "Setting up Drupal virtual host..." - # Clone new Drupal skeleton files. + # Clone Drupal skeleton files. if [[ ${INSTALL_APP} == true ]]; then - # Check Drupal install directory. + # Checking Drupal installation. if [ ! -d "${WEBROOT}/core/lib/Drupal" ]; then echo "Downloading Drupal latest skeleton files..." @@ -1118,7 +1179,7 @@ function init_app() { fi #run wget -q -O "${WEBROOT}/favicon.ico" \ - # https://github.com/joglomedia/LEMPer/raw/master/favicon.ico + # https://github.com/joglomedia/LEMPer/raw/master/.github/assets/favicon.ico # Fix ownership. run chown -hR "${USERNAME}:${USERNAME}" "${WEBROOT}" @@ -1129,12 +1190,11 @@ function init_app() { ;; laravel|lumen) - echo "Setting up Laravel framework virtual host..." + echo "Setting up ${FRAMEWORK^} framework virtual host..." - # Install Laravel framework skeleton - # clone new Laravel files. + # Clone Laravel/Lumen skeleton files. if [[ ${INSTALL_APP} == true ]]; then - # Check Laravel install. + # Checking Laravel installation. if [ ! -f "${WEBROOT}/artisan" ]; then echo "Downloading ${FRAMEWORK^} skeleton files..." @@ -1163,7 +1223,7 @@ function init_app() { fi #run wget -q -O "${WEBROOT}/public/favicon.ico" \ - # https://github.com/joglomedia/LEMPer/raw/master/favicon.ico + # https://github.com/joglomedia/LEMPer/raw/master/.github/assets/favicon.ico # Fix ownership. run chown -hR "${USERNAME}:${USERNAME}" "${WEBROOT}" @@ -1177,13 +1237,13 @@ function init_app() { ;; phalcon|phalcon-cli|phalcon-micro|phalcon-modules) - echo "Setting up ${FRAMEWORK^} framework virtual host..." + echo "Setting up Phalcon framework virtual host..." - # Auto install Phalcon PHP framework skeleton. + # Clone Phalcon skeleton files. if [[ ${INSTALL_APP} == true ]]; then - # Check Phalcon skeleton install. + # Checking Phalcon installation. if [ ! -f "${WEBROOT}/app/config/config.php" ]; then - echo "Downloading ${FRAMEWORK^} skeleton files..." + echo "Downloading ${FRAMEWORK} skeleton files..." # Switch Phalcon framework type. case "${FRAMEWORK}" in @@ -1208,10 +1268,10 @@ function init_app() { else run git clone -q --depth=1 --branch=master \ "https://github.com/joglomedia/${FRAMEWORK}-skeleton.git" "${WEBROOT}" || \ - error "Something went wrong while downloading ${FRAMEWORK^} files." + error "Something went wrong while downloading ${FRAMEWORK} files." fi else - info "It seems that ${FRAMEWORK^} skeleton files already exists." + info "It seems that ${FRAMEWORK} skeleton files already exists." fi else # Create default index file. @@ -1228,7 +1288,7 @@ function init_app() { fi #run wget -q -O "${WEBROOT}/public/favicon.ico" \ - # https://github.com/joglomedia/LEMPer/raw/master/favicon.ico + # https://github.com/joglomedia/LEMPer/raw/master/.github/assets/favicon.ico # Fix ownership. run chown -hR "${USERNAME}:${USERNAME}" "${WEBROOT}" @@ -1244,9 +1304,9 @@ function init_app() { symfony) echo "Setting up Symfony framework virtual host..." - # Auto install Symfony PHP framework skeleton. + # Clone Symfony skeleton files. if [[ ${INSTALL_APP} == true ]]; then - # Check Symfony install. + # Checking Symfony installation. if [ ! -f "${WEBROOT}/src/Kernel.php" ]; then echo "Downloading Symfony skeleton files..." @@ -1282,7 +1342,7 @@ function init_app() { fi #run wget -q -O "${WEBROOT}/public/favicon.ico" \ - # https://github.com/joglomedia/LEMPer/raw/master/favicon.ico + # https://github.com/joglomedia/LEMPer/raw/master/.github/assets/favicon.ico # Fix ownership. run chown -hR "${USERNAME}:${USERNAME}" "${WEBROOT}" @@ -1359,7 +1419,7 @@ _EOL_ # Enable sunrise. (insert new line before match) run sed -i "/\/*\ That/i define( 'SUNRISE', true );\n" "${WEBROOT}/wp-config.php" - # Pre-populate blog id mapping, used by Nginx vhost config. + # Pre-populate blog id mapping, used by NGINX vhost config. if [ ! -d "${WEBROOT}/wp-content/uploads/nginx-helper" ]; then run mkdir -p "${WEBROOT}/wp-content/uploads/nginx-helper" fi @@ -1416,7 +1476,7 @@ _EOL_ fi #run wget -q -O "${WEBROOT}/favicon.ico" \ - # https://github.com/joglomedia/LEMPer/raw/master/favicon.ico + # https://github.com/joglomedia/LEMPer/raw/master/.github/assets/favicon.ico # Fix ownership. run chown -hR "${USERNAME}:${USERNAME}" "${WEBROOT}" @@ -1426,7 +1486,7 @@ _EOL_ create_vhost_default > "${VHOST_FILE}" ;; - default|codeigniter|mautic|roundcube|sendy) + default|mautic|roundcube|sendy) # TODO: Auto install framework skeleton. # Create default index file. @@ -1435,7 +1495,7 @@ _EOL_ fi #run wget -q -O "${WEBROOT}/favicon.ico" \ - # https://github.com/joglomedia/LEMPer/raw/master/favicon.ico + # https://github.com/joglomedia/LEMPer/raw/master/.github/assets/favicon.ico # Fix ownership. run chown -hR "${USERNAME}:${USERNAME}" "${WEBROOT}" @@ -1447,7 +1507,7 @@ _EOL_ *) # Not supported framework/cms, abort. - fail "Sorry, your framework/cms [${FRAMEWORK^}] is not supported yet. Aborting..." + fail "Sorry, your framework/cms [${FRAMEWORK^}] is not supported yet. Please submit an issue at Github..." exit 1 ;; esac @@ -1523,7 +1583,7 @@ _EOL_ run sed -i "s|#pagespeed\ Disallow|pagespeed\ Disallow|g" "${VHOST_FILE}" run sed -i "s|#pagespeed\ Domain|pagespeed\ Domain|g" "${VHOST_FILE}" else - info "Mod PageSpeed is not enabled. Nginx must be installed with PageSpeed module." + info "Mod PageSpeed is not enabled. NGINX must be installed with PageSpeed module." fi fi @@ -1572,18 +1632,18 @@ _EOL_ fi # Reload Nginx - echo "Reloading Nginx HTTP server configuration..." + echo "Reloading NGINX server configuration..." # Validate config, reload when validated. if nginx -t 2>/dev/null > /dev/null; then run systemctl reload nginx - echo "Nginx HTTP server reloaded with new configuration." + echo "NGINX server reloaded with new configuration." else - info "Something went wrong with Nginx configuration." + info "Something went wrong with NGINX configuration." fi if [[ -f "/etc/nginx/sites-enabled/${SERVERNAME}.conf" && -e /var/run/nginx.pid ]]; then - success "Your ${SERVERNAME} successfully added to Nginx virtual host." + success "Your ${SERVERNAME} successfully added to NGINX virtual host." # Enable HTTPS. if [[ ${ENABLE_SSL} == true ]]; then @@ -1597,7 +1657,7 @@ _EOL_ if [ "${FRAMEWORK}" = "wordpress-ms" ]; then echo >&2 info "Note: You're installing Wordpress Multisite." - info "You should activate Nginx Helper plugin to work properly." + info "You should activate NGINX Helper plugin to work properly." fi # App install details @@ -1609,7 +1669,7 @@ _EOL_ if "${DRYRUN}"; then info "Your ${SERVERNAME} successfully added in dryrun mode." else - fail "An error occurred when adding ${SERVERNAME} to Nginx virtual host." + fail "An error occurred when adding ${SERVERNAME} to NGINX virtual host." fi fi else diff --git a/lib/lemper-manage.sh b/lib/lemper-manage.sh index 05c3b0c4..9ceebd10 100755 --- a/lib/lemper-manage.sh +++ b/lib/lemper-manage.sh @@ -114,8 +114,8 @@ fi function show_usage() { cat <<- _EOF_ ${APP_NAME^} ${APP_VERSION} -Simple NGiNX virtual host (vHost) manager, -enable/disable/remove NGiNX vHost on Debian/Ubuntu Server. +Simple NGINX virtual host (vHost) manager, +enable/disable/remove NGINX vHost on Debian/Ubuntu Server. Requirements: * LEMP stack setup uses [LEMPer](https://github.com/joglomedia/LEMPer) @@ -124,7 +124,7 @@ Usage: ${CMD_PARENT} ${CMD_NAME} [OPTION]... Options: - -b, --enable-brotli + -b, --enable-brotli Enable Brotli compression. -c, --enable-fastcgi-cache Enable FastCGI cache. @@ -138,8 +138,10 @@ Options: Enable fail2ban jail. --disable-fail2ban Disable fail2ban jail. - -g, --enable-gzip + -g, --enable-gzip Enable Gzip compression. + --disable-compression + Disable Gzip/Brotli compression. -p, --enable-pagespeed Enable Mod PageSpeed. --disable-pagespeed @@ -173,19 +175,20 @@ _EOF_ # function enable_vhost() { # Verify user input hostname (domain name) - verify_vhost "${1}" + local DOMAIN=${1} + verify_vhost "${DOMAIN}" - echo "Enabling virtual host: ${1}..." + echo "Enabling virtual host: ${DOMAIN}..." # Enable Nginx's vhost config. - if [[ ! -f "/etc/nginx/sites-enabled/${1}.conf" && -f "/etc/nginx/sites-available/${1}.conf" ]]; then - run ln -s "/etc/nginx/sites-available/${1}.conf" "/etc/nginx/sites-enabled/${1}.conf" + if [[ ! -f "/etc/nginx/sites-enabled/${DOMAIN}.conf" && -f "/etc/nginx/sites-available/${DOMAIN}.conf" ]]; then + run ln -s "/etc/nginx/sites-available/${DOMAIN}.conf" "/etc/nginx/sites-enabled/${DOMAIN}.conf" - success "Your virtual host ${1} has been enabled..." + success "Your virtual host ${DOMAIN} has been enabled..." reload_nginx else - fail "${1} couldn't be enabled. Probably, it has been enabled or not created yet." + fail "${DOMAIN} couldn't be enabled. Probably, it has been enabled or not created yet." exit 1 fi } @@ -195,19 +198,20 @@ function enable_vhost() { # function disable_vhost() { # Verify user input hostname (domain name) - verify_vhost "${1}" + local DOMAIN=${1} + verify_vhost "${DOMAIN}" - echo "Disabling virtual host: ${1}..." + echo "Disabling virtual host: ${DOMAIN}..." # Disable Nginx's vhost config. - if [ -f "/etc/nginx/sites-enabled/${1}.conf" ]; then - run unlink "/etc/nginx/sites-enabled/${1}.conf" + if [ -f "/etc/nginx/sites-enabled/${DOMAIN}.conf" ]; then + run unlink "/etc/nginx/sites-enabled/${DOMAIN}.conf" - success "Your virtual host ${1} has been disabled..." + success "Your virtual host ${DOMAIN} has been disabled..." reload_nginx else - fail "${1} couldn't be disabled. Probably, it has been disabled or removed." + fail "${DOMAIN} couldn't be disabled. Probably, it has been disabled or removed." exit 1 fi } @@ -217,7 +221,8 @@ function disable_vhost() { # function remove_vhost() { # Verify user input hostname (domain name) - verify_vhost "${1}" + local DOMAIN=${1} + verify_vhost "${DOMAIN}" echo "Removing virtual host is not reversible." read -t 30 -rp "Press [Enter] to continue..." "/etc/fail2ban/jail.d/${1}.conf" <<_EOL_ + cat > "/etc/fail2ban/jail.d/${DOMAIN}.conf" <<_EOL_ [${1}] enabled = true port = http,https @@ -347,18 +353,19 @@ _EOL_ # function enable_fastcgi_cache() { # Verify user input hostname (domain name) - verify_vhost "${1}" + local DOMAIN=${1} + verify_vhost "${DOMAIN}" - echo "Enabling FastCGI cache for ${1}..." + echo "Enabling FastCGI cache for ${DOMAIN}..." if [ -f /etc/nginx/includes/rules_fastcgi_cache.conf ]; then # enable cached directives run sed -i "s|#include\ /etc/nginx/includes/rules_fastcgi_cache.conf|include\ /etc/nginx/includes/rules_fastcgi_cache.conf|g" \ - "/etc/nginx/sites-available/${1}.conf" + "/etc/nginx/sites-available/${DOMAIN}.conf" # enable fastcgi_cache conf run sed -i "s|#include\ /etc/nginx/includes/fastcgi_cache.conf|include\ /etc/nginx/includes/fastcgi_cache.conf|g" \ - "/etc/nginx/sites-available/${1}.conf" + "/etc/nginx/sites-available/${DOMAIN}.conf" else info "FastCGI cache is not enabled. There is no cached configuration." exit 1 @@ -373,18 +380,19 @@ function enable_fastcgi_cache() { # function disable_fastcgi_cache() { # Verify user input hostname (domain name) - verify_vhost "${1}" + local DOMAIN=${1} + verify_vhost "${DOMAIN}" - echo "Disabling FastCGI cache for ${1}..." + echo "Disabling FastCGI cache for ${DOMAIN}..." if [ -f /etc/nginx/includes/rules_fastcgi_cache.conf ]; then # enable cached directives run sed -i "s|^\ include\ /etc/nginx/includes/rules_fastcgi_cache.conf|\ #include\ /etc/nginx/includes/rules_fastcgi_cache.conf|g" \ - "/etc/nginx/sites-available/${1}.conf" + "/etc/nginx/sites-available/${DOMAIN}.conf" # enable fastcgi_cache conf run sed -i "s|^\ include\ /etc/nginx/includes/fastcgi_cache.conf|\ #include\ /etc/nginx/includes/fastcgi_cache.conf|g" \ - "/etc/nginx/sites-available/${1}.conf" + "/etc/nginx/sites-available/${DOMAIN}.conf" else info "FastCGI cache is not enabled. There is no cached configuration." exit 1 @@ -399,29 +407,30 @@ function disable_fastcgi_cache() { # function enable_mod_pagespeed() { # Verify user input hostname (domain name) - verify_vhost "${1}" + local DOMAIN=${1} + verify_vhost "${DOMAIN}" - echo "Enabling Mod PageSpeed for ${1}..." + echo "Enabling Mod PageSpeed for ${DOMAIN}..." if [[ -f /etc/nginx/includes/mod_pagespeed.conf && -f /etc/nginx/modules-enabled/60-mod-pagespeed.conf ]]; then # enable mod pagespeed run sed -i "s|#include\ /etc/nginx/mod_pagespeed|include\ /etc/nginx/mod_pagespeed|g" /etc/nginx/nginx.conf run sed -i "s|#include\ /etc/nginx/includes/mod_pagespeed.conf|include\ /etc/nginx/includes/mod_pagespeed.conf|g" \ - "/etc/nginx/sites-available/${1}.conf" + "/etc/nginx/sites-available/${DOMAIN}.conf" run sed -i "s|#pagespeed\ EnableFilters|pagespeed\ EnableFilters|g" \ - "/etc/nginx/sites-available/${1}.conf" - run sed -i "s|#pagespeed\ Disallow|pagespeed\ Disallow|g" "/etc/nginx/sites-available/${1}.conf" - run sed -i "s|#pagespeed\ Domain|pagespeed\ Domain|g" "/etc/nginx/sites-available/${1}.conf" + "/etc/nginx/sites-available/${DOMAIN}.conf" + run sed -i "s|#pagespeed\ Disallow|pagespeed\ Disallow|g" "/etc/nginx/sites-available/${DOMAIN}.conf" + run sed -i "s|#pagespeed\ Domain|pagespeed\ Domain|g" "/etc/nginx/sites-available/${DOMAIN}.conf" # If SSL enabled, ensure to also to enable PageSpeed related vars. - #if grep -qwE "^\ include\ /etc/nginx/includes/ssl.conf" "/etc/nginx/sites-available/${1}.conf"; then + #if grep -qwE "^\ include\ /etc/nginx/includes/ssl.conf" "/etc/nginx/sites-available/${DOMAIN}.conf"; then # run sed -i "s/#pagespeed\ FetchHttps/pagespeed\ FetchHttps/g" \ - # "/etc/nginx/sites-available/${1}.conf" + # "/etc/nginx/sites-available/${DOMAIN}.conf" # run sed -i "s/#pagespeed\ MapOriginDomain/pagespeed\ MapOriginDomain/g" \ - # "/etc/nginx/sites-available/${1}.conf" + # "/etc/nginx/sites-available/${DOMAIN}.conf" #fi else - info "Mod PageSpeed is not enabled. NGiNX must be installed with PageSpeed module." + info "Mod PageSpeed is not enabled. NGINX must be installed with PageSpeed module." exit 1 fi @@ -434,28 +443,29 @@ function enable_mod_pagespeed() { # function disable_mod_pagespeed() { # Verify user input hostname (domain name) - verify_vhost "${1}" + local DOMAIN=${1} + verify_vhost "${DOMAIN}" - echo "Disabling Mod PageSpeed for ${1}..." + echo "Disabling Mod PageSpeed for ${DOMAIN}..." if [[ -f /etc/nginx/includes/mod_pagespeed.conf && -f /etc/nginx/modules-enabled/60-mod-pagespeed.conf ]]; then # Disable mod pagespeed #run sed -i "s|^\ include\ /etc/nginx/mod_pagespeed|\ #include\ /etc/nginx/mod_pagespeed|g" /etc/nginx/nginx.conf run sed -i "s|^\ include\ /etc/nginx/includes/mod_pagespeed.conf|\ #include\ /etc/nginx/includes/mod_pagespeed.conf|g" \ - "/etc/nginx/sites-available/${1}.conf" - run sed -i "s|^\ pagespeed\ EnableFilters|\ #pagespeed\ EnableFilters|g" "/etc/nginx/sites-available/${1}.conf" - run sed -i "s|^\ pagespeed\ Disallow|\ #pagespeed\ Disallow|g" "/etc/nginx/sites-available/${1}.conf" - run sed -i "s|^\ pagespeed\ Domain|\ #pagespeed\ Domain|g" "/etc/nginx/sites-available/${1}.conf" + "/etc/nginx/sites-available/${DOMAIN}.conf" + run sed -i "s|^\ pagespeed\ EnableFilters|\ #pagespeed\ EnableFilters|g" "/etc/nginx/sites-available/${DOMAIN}.conf" + run sed -i "s|^\ pagespeed\ Disallow|\ #pagespeed\ Disallow|g" "/etc/nginx/sites-available/${DOMAIN}.conf" + run sed -i "s|^\ pagespeed\ Domain|\ #pagespeed\ Domain|g" "/etc/nginx/sites-available/${DOMAIN}.conf" # If SSL enabled, ensure to also disable PageSpeed related vars. - #if grep -qwE "\ include /etc/nginx/includes/ssl.conf" "/etc/nginx/sites-available/${1}.conf"; then + #if grep -qwE "\ include /etc/nginx/includes/ssl.conf" "/etc/nginx/sites-available/${DOMAIN}.conf"; then # run sed -i "s/^\ pagespeed\ FetchHttps/\ #pagespeed\ FetchHttps/g" \ - # "/etc/nginx/sites-available/${1}.conf" + # "/etc/nginx/sites-available/${DOMAIN}.conf" # run sed -i "s/^\ pagespeed\ MapOriginDomain/\ #pagespeed\ MapOriginDomain/g" \ - # "/etc/nginx/sites-available/${1}.conf" + # "/etc/nginx/sites-available/${DOMAIN}.conf" #fi else - info "Mod PageSpeed is not enabled. NGiNX must be installed with PageSpeed module." + info "Mod PageSpeed is not enabled. NGINX must be installed with PageSpeed module." exit 1 fi @@ -468,28 +478,29 @@ function disable_mod_pagespeed() { # function enable_ssl() { # Verify user input hostname (domain name). - verify_vhost "${1}" + local DOMAIN=${1} + verify_vhost "${DOMAIN}" #TODO: Generate Let's Encrypt SSL using Certbot. - if [ ! -d "/etc/letsencrypt/live/${1}" ]; then + if [ ! -d "/etc/letsencrypt/live/${DOMAIN}" ]; then echo "Certbot: Get Let's Encrypt certificate..." # Get web root path from vhost config, first. #shellcheck disable=SC2154 local WEBROOT && \ - WEBROOT=$(grep -wE "set\ \\\$root_path" "/etc/nginx/sites-available/${1}.conf" | awk '{print $3}' | cut -d'"' -f2) + WEBROOT=$(grep -wE "set\ \\\$root_path" "/etc/nginx/sites-available/${DOMAIN}.conf" | awk '{print $3}' | cut -d'"' -f2) # Certbot get Let's Encrypt SSL. if [[ -n $(command -v certbot) ]]; then # Is it wildcard vhost? - if grep -qwE "${1}\ \*.${1}" "/etc/nginx/sites-available/${1}.conf"; then + if grep -qwE "${DOMAIN}\ \*.${DOMAIN}" "/etc/nginx/sites-available/${DOMAIN}.conf"; then #run certbot certonly --rsa-key-size 4096 --manual --agree-tos --preferred-challenges dns --manual-public-ip-logging-ok \ - # --webroot-path="${WEBROOT}" -d "${1}" -d "*.${1}" + # --webroot-path="${WEBROOT}" -d "${DOMAIN}" -d "*.${DOMAIN}" run certbot certonly --manual --agree-tos --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory \ - --manual-public-ip-logging-ok --webroot-path="${WEBROOT}" -d "${1}" -d "*.${1}" + --manual-public-ip-logging-ok --webroot-path="${WEBROOT}" -d "${DOMAIN}" -d "*.${DOMAIN}" else - #run certbot certonly --rsa-key-size 4096 --webroot --agree-tos --preferred-challenges http --webroot-path="${WEBROOT}" -d "${1}" - run certbot certonly --webroot --agree-tos --preferred-challenges http --webroot-path="${WEBROOT}" -d "${1}" + #run certbot certonly --rsa-key-size 4096 --webroot --agree-tos --preferred-challenges http --webroot-path="${WEBROOT}" -d "${DOMAIN}" + run certbot certonly --webroot --agree-tos --preferred-challenges http --webroot-path="${WEBROOT}" -d "${DOMAIN}" fi else fail "Certbot executable binary not found. Install it first!" @@ -509,34 +520,34 @@ function enable_ssl() { info "Updating HTTPS config in dryrun mode." else # Ensure there is no HTTPS enabled server block. - if ! grep -qwE "^\ listen\ 443 ssl http2" "/etc/nginx/sites-available/${1}.conf"; then + if ! grep -qwE "^\ listen\ 443 ssl http2" "/etc/nginx/sites-available/${DOMAIN}.conf"; then # Make backup first. - run cp -f "/etc/nginx/sites-available/${1}.conf" "/etc/nginx/sites-available/${1}.nonssl-conf" + run cp -f "/etc/nginx/sites-available/${DOMAIN}.conf" "/etc/nginx/sites-available/${DOMAIN}.nonssl-conf" # Change listening port to 443. - run sed -i "s/listen\ 80/listen\ 443 ssl http2/g" "/etc/nginx/sites-available/${1}.conf" - run sed -i "s/listen\ \[::\]:80/listen\ \[::\]:443 ssl http2/g" "/etc/nginx/sites-available/${1}.conf" + run sed -i "s/listen\ 80/listen\ 443 ssl http2/g" "/etc/nginx/sites-available/${DOMAIN}.conf" + run sed -i "s/listen\ \[::\]:80/listen\ \[::\]:443 ssl http2/g" "/etc/nginx/sites-available/${DOMAIN}.conf" # Enable SSL configs. - run sed -i "s/#ssl_certificate/ssl_certificate/g" "/etc/nginx/sites-available/${1}.conf" - run sed -i "s/#ssl_certificate_key/ssl_certificate_key/g" "/etc/nginx/sites-available/${1}.conf" - run sed -i "s/#ssl_trusted_certificate/ssl_trusted_certificate/g" "/etc/nginx/sites-available/${1}.conf" + run sed -i "s/#ssl_certificate/ssl_certificate/g" "/etc/nginx/sites-available/${DOMAIN}.conf" + run sed -i "s/#ssl_certificate_key/ssl_certificate_key/g" "/etc/nginx/sites-available/${DOMAIN}.conf" + run sed -i "s/#ssl_trusted_certificate/ssl_trusted_certificate/g" "/etc/nginx/sites-available/${DOMAIN}.conf" run sed -i "s|#include\ /etc/nginx/includes/ssl.conf|include\ /etc/nginx/includes/ssl.conf|g" \ - "/etc/nginx/sites-available/${1}.conf" + "/etc/nginx/sites-available/${DOMAIN}.conf" # Adjust PageSpeed if enabled. #if grep -qwE "^\ include\ /etc/nginx/includes/mod_pagespeed.conf" \ - # "/etc/nginx/sites-available/${1}.conf"; then + # "/etc/nginx/sites-available/${DOMAIN}.conf"; then # echo "Adjusting PageSpeed configuration..." # run sed -i "s/#pagespeed\ FetchHttps/pagespeed\ FetchHttps/g" \ - # "/etc/nginx/sites-available/${1}.conf" + # "/etc/nginx/sites-available/${DOMAIN}.conf" # run sed -i "s/#pagespeed\ MapOriginDomain/pagespeed\ MapOriginDomain/g" \ - # "/etc/nginx/sites-available/${1}.conf" + # "/etc/nginx/sites-available/${DOMAIN}.conf" #fi # Append redirection block. - cat >> "/etc/nginx/sites-available/${1}.conf" <> "/etc/nginx/sites-available/${DOMAIN}.conf" </dev/null > /dev/null; then @@ -771,7 +812,7 @@ function reload_nginx() { nginx -t exit 1 fi - # NGiNX service dead? Try to start it. + # NGINX service dead? Try to start it. else if [[ -n $(command -v nginx) ]]; then if nginx -t 2>/dev/null > /dev/null; then @@ -801,8 +842,8 @@ function reload_nginx() { # function init_app() { OPTS=$(getopt -o e:d:r:c:p:s:bghv \ - -l enable:,disable:,remove:,enable-fastcgi-cache:,disable-fastcgi-cache:,enable-pagespeed: \ - -l disable-pagespeed:,enable-ssl:,disable-ssl:,remove-ssl:,renew-ssl:,enable-brotli,enable-gzip,help,version \ + -l enable:,disable:,remove:,enable-fastcgi-cache:,disable-fastcgi-cache:,enable-pagespeed:,disable-pagespeed: \ + -l enable-ssl:,disable-ssl:,remove-ssl:,renew-ssl:,enable-brotli:,enable-gzip:,disable-compression:,help,version \ -n "${APP_NAME}" -- "$@") eval set -- "${OPTS}" @@ -855,11 +896,15 @@ function init_app() { shift 2 ;; -b | --enable-brotli) - enable_brotli + enable_brotli "${2}" shift 2 ;; -g | --enable-gzip) - enable_gzip + enable_gzip "${2}" + shift 2 + ;; + --disable-compression) + disable_compression "${2}" shift 2 ;; -h | --help) From 7b4ccb7de7da47cf4a034abd97b03a90f2ef3a5e Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Mon, 12 Jul 2021 22:22:05 +0700 Subject: [PATCH 12/20] Add CodeIgniter --- etc/nginx/vhost/site_codeigniter.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/nginx/vhost/site_codeigniter.conf b/etc/nginx/vhost/site_codeigniter.conf index 878c1dbc..b34e1eb3 100644 --- a/etc/nginx/vhost/site_codeigniter.conf +++ b/etc/nginx/vhost/site_codeigniter.conf @@ -2,7 +2,7 @@ # Designed to be included in any server {} block. location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php?$is_args$args; # Uncomment to enable naxsi on this location #include /etc/nginx/naxsi.rules From 9bca8eab9255bf62b0488cf08c09bb1975d2551d Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Mon, 12 Jul 2021 22:23:01 +0700 Subject: [PATCH 13/20] Fix Nginx install --- scripts/install_nginx.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/install_nginx.sh b/scripts/install_nginx.sh index aac30fa8..a9407229 100755 --- a/scripts/install_nginx.sh +++ b/scripts/install_nginx.sh @@ -292,18 +292,18 @@ function init_nginx_install() { local NGINX_VERSION=${NGINX_VERSION:-"stable"} if [[ ${NGINX_VERSION} == "mainline" || ${NGINX_VERSION} == "latest" ]]; then # Nginx mainline version. - NGINX_RELEASE_VER=$(determine_latest_nginx_version) + NGINX_RELEASE_VERSION=$(determine_latest_nginx_version) elif [[ ${NGINX_VERSION} == "stable" || ${NGINX_VERSION} == "lts" ]]; then # Nginx stable version. - NGINX_RELEASE_VER=$(determine_stable_nginx_version) + NGINX_RELEASE_VERSION=$(determine_stable_nginx_version) else # Fallback to default stable version. - NGINX_RELEASE_VER="${NGINX_VERSION}" + NGINX_RELEASE_VERSION="${NGINX_VERSION}" fi if "${DRYRUN}"; then run "${BUILD_DIR}/build_nginx" -v latest-stable \ - -n "${NGINX_RELEASE_VER}" --dynamic-module --extra-modules -y --dryrun + -n "${NGINX_RELEASE_VERSION}" --dynamic-module --extra-modules -y --dryrun else # Nginx configure arguments. NGX_CONFIGURE_ARGS="" @@ -990,7 +990,7 @@ function init_nginx_install() { if curl -sLI "${NGX_BUILD_URL}" | grep -q "HTTP/[.12]* [2].."; then run curl -sS -o "${BUILD_DIR}/build_nginx" "${NGX_BUILD_URL}" && \ - run bash "${BUILD_DIR}/build_nginx" -v latest-stable -n "${NGINX_RELEASE_VER}" --dynamic-module \ + run bash "${BUILD_DIR}/build_nginx" -v latest-stable -n "${NGINX_RELEASE_VERSION}" --dynamic-module \ -b "${BUILD_DIR}" -a "${NGX_CONFIGURE_ARGS}" -y else error "Nginx from source installer not found." From 842351d66e455db30298905cd3379f5f7b80ef3e Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Mon, 12 Jul 2021 22:23:16 +0700 Subject: [PATCH 14/20] Fix Readme --- scripts/README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 010575c0..89ea31bd 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,8 +1,5 @@ -Installer Scripts ----------------------- +# Installer Scripts This is just a bunch of my script collections. Do pull request to make improvement! - -eslabs.id@gmail.com From 24f09050487f94a7481cfc067139e51c5e176cd4 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Mon, 12 Jul 2021 22:24:00 +0700 Subject: [PATCH 15/20] Add assets images --- .github/assets/favicon.ico | Bin 0 -> 1150 bytes .github/assets/lemper-logo.svg | 181 +++++++++++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 .github/assets/favicon.ico create mode 100644 .github/assets/lemper-logo.svg diff --git a/.github/assets/favicon.ico b/.github/assets/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..6bc005b5d752a35ca8ff6207116e05137234d22d GIT binary patch literal 1150 zcmaiz&r2Io5XVQ?MkoOP6kz8uBCq2y(lDotZ zEl>iU7mTteJir@n$H4=K=`!w|Xw9jYwwvsUA|h9b@X#WjnETsmi2116%(?H!eE0b{-%RNjo?pKM%((Nl zn^$ww{PM#RPcDuIUH|WwcVLSbWMW(68%qOhq?&i;Ki|eZiW>qMPzd^_)y470Lw?80 z3ve?)TylvaTA&0P@AAA~f@6UgAi-Pi3=J^}vg!*t&GS=H2fbO41e)LTe2MN1iDCF@ kbNf;;{$#Ldq(;(k!r}$p3jT_AH_;ExKdF5#z2b=b4+N` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From f5ab4f612491cc07163119f8643554c24cf86b92 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Mon, 12 Jul 2021 22:24:33 +0700 Subject: [PATCH 16/20] Update README --- README.md | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 241177ae..4b3bb0b6 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,7 @@ # [L]inux [E]ngine-X [M]ariaDB [P]HP Install[ER]

-

-Served by
- _     _____ __  __ ____           
-| |   | ____|  \/  |  _ \ ___ _ __ 
-| |   |  _| | |\/| | |_) / _ \ '__|
-| |___| |___| |  | |  __/  __/ |   
-|_____|_____|_|  |_|_|   \___|_|      
-
+ Serverd by LEMPer Stack © @joglomedia

@@ -17,11 +10,11 @@ Served by GitHub forks GitHub issues GitHub CI -GitHub license +GitHub license

-LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in Bash script. This is just a small tool set (a bunch collection of scripts) that usually I use to deploy and manage LEMP stack on Debian/Ubuntu. LEMPer is CloudWays, Ploi, RunCloud, and ServerPilot free alternative crafted to support wide-range PHP framework & CMS. +LEMPer stands for Linux, Engine-X (Nginx), MariaDB and PHP installer written in Bash script. This is just a small toolset (a bunch collection of scripts) that usually I use to deploy and manage LEMP stack on Debian/Ubuntu server. LEMPer is crafted to support wide-range PHP framework & CMS. It is available as Free Alternative to control panel such as cPanel, Plesk, CloudWays, Ploi, RunCloud, ServerPilot, etc.

## Features @@ -142,7 +135,7 @@ http://YOUR_DOMAIN_NAME:8082/lcp/filemanager ## Security Vulnerabilities and Bugs -If you discover any security vulnerability or any bug within _EasyDock Linux_, please open an issue. +If you discover any security vulnerability or any bug within _LEMPer Stack_, please open an issue. ## Contributing From 003e36adac70ffe1a2a10e6e8ac7bebb0fbd349a Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Mon, 12 Jul 2021 22:25:30 +0700 Subject: [PATCH 17/20] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b3bb0b6..b4a4365f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # [L]inux [E]ngine-X [M]ariaDB [P]HP Install[ER]

- Serverd by LEMPer Stack © @joglomedia + Serverd by LEMPer Stack © @joglomedia

From 046b769efcc40800869712fba8780f052121f268 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Mon, 12 Jul 2021 22:29:42 +0700 Subject: [PATCH 18/20] Update logo file --- .github/assets/lemper-logo.svg | 416 +++++++++++++++++++-------------- 1 file changed, 238 insertions(+), 178 deletions(-) diff --git a/.github/assets/lemper-logo.svg b/.github/assets/lemper-logo.svg index 38607944..33d151cb 100644 --- a/.github/assets/lemper-logo.svg +++ b/.github/assets/lemper-logo.svg @@ -1,181 +1,241 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file From eea919be01c022cf19d47466284c192a89932040 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Mon, 12 Jul 2021 22:47:06 +0700 Subject: [PATCH 19/20] Fix mod brotli file location --- lib/lemper-manage.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/lemper-manage.sh b/lib/lemper-manage.sh index 9ceebd10..fdf0229b 100755 --- a/lib/lemper-manage.sh +++ b/lib/lemper-manage.sh @@ -688,18 +688,18 @@ function enable_brotli() { local DOMAIN=${1} verify_vhost "${DOMAIN}" - if [[ -f "/etc/nginx/sites-available/${DOMAIN}.conf" && -f /etc/nginx/modules-enabled/50-mod-http-brotli-static.conf ]]; then + if [[ -f "/etc/nginx/sites-available/${DOMAIN}.conf" && -f /etc/nginx/modules-enabled/20-mod-http-brotli-static.conf ]]; then echo "Enable NGINX Brotli compression..." - if grep -qwE "^\ include\ /etc/nginx/includes/compression_brotli.conf" "/etc/nginx/sites-available/${DOMAIN}.conf"; then + if grep -qwE "^\ include\ /etc/nginx/includes/compression_brotli.conf;" "/etc/nginx/sites-available/${DOMAIN}.conf"; then info "Brotli compression module already enabled." exit 0 - elif grep -qwE "^\ include\ /etc/nginx/includes/compression_gzip.conf" "/etc/nginx/sites-available/${DOMAIN}.conf"; then + elif grep -qwE "^\ include\ /etc/nginx/includes/compression_gzip.conf;" "/etc/nginx/sites-available/${DOMAIN}.conf"; then echo "Found Gzip compression enabled, updating to Brotli..." run sed -i "s|include\ /etc/nginx/includes/compression_[a-z]*\.conf;|include\ /etc/nginx/includes/compression_brotli.conf;|g" \ "/etc/nginx/sites-available/${DOMAIN}.conf" - elif grep -qwE "^\ #include\ /etc/nginx/includes/compression_[a-z]*\.conf" "/etc/nginx/sites-available/${DOMAIN}.conf"; then + elif grep -qwE "^\ #include\ /etc/nginx/includes/compression_[a-z]*\.conf;" "/etc/nginx/sites-available/${DOMAIN}.conf"; then echo "Enabling Brotli compression module..." run sed -i "s|#include\ /etc/nginx/includes/compression_[a-z]*\.conf;|include\ /etc/nginx/includes/compression_brotli.conf;|g" \ @@ -729,15 +729,15 @@ function enable_gzip() { if [[ -f "/etc/nginx/sites-available/${DOMAIN}.conf" && -f /etc/nginx/includes/compression_gzip.conf ]]; then echo "Enable NGINX Gzip compression..." - if grep -qwE "^\ include\ /etc/nginx/includes/compression_gzip.conf" "/etc/nginx/sites-available/${DOMAIN}.conf"; then + if grep -qwE "^\ include\ /etc/nginx/includes/compression_gzip.conf;" "/etc/nginx/sites-available/${DOMAIN}.conf"; then info "Gzip compression module already enabled." exit 0 - elif grep -qwE "^\ include\ /etc/nginx/includes/compression_brotli.conf" "/etc/nginx/sites-available/${DOMAIN}.conf"; then + elif grep -qwE "^\ include\ /etc/nginx/includes/compression_brotli.conf;" "/etc/nginx/sites-available/${DOMAIN}.conf"; then echo "Found Brotli compression enabled, updating to Gzip..." run sed -i "s|include\ /etc/nginx/includes/compression_[a-z]*\.conf;|include\ /etc/nginx/includes/compression_gzip.conf;|g" \ "/etc/nginx/sites-available/${DOMAIN}.conf" - elif grep -qwE "^\ #include\ /etc/nginx/includes/compression_[a-z]*\.conf" "/etc/nginx/sites-available/${DOMAIN}.conf"; then + elif grep -qwE "^\ #include\ /etc/nginx/includes/compression_[a-z]*\.conf;" "/etc/nginx/sites-available/${DOMAIN}.conf"; then echo "Enabling Gzip compression module..." run sed -i "s|#include\ /etc/nginx/includes/compression_[a-z]*\.conf;|include\ /etc/nginx/includes/compression_gzip.conf;|g" \ @@ -769,8 +769,7 @@ function disable_compression() { run sed -i "s|include\ /etc/nginx/includes/compression_[a-z]*\.conf;|#include\ /etc/nginx/includes/compression_gzip.conf;|g" \ "/etc/nginx/sites-available/${DOMAIN}.conf" else - error "Sorry, we couldn't find any compression module section." - echo "We recommend you to enable Gzip module manually." + error "Sorry, we couldn't find any enabled compression module." exit 1 fi From a0a9f46bdb583cb5d4532edb5dd370d7b71dd894 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Mon, 12 Jul 2021 23:04:42 +0700 Subject: [PATCH 20/20] Fix Error: Failure running 'cp -f etc/nginx/comp_brotli etc/nginx/comp_gzip /etc/nginx/' --- scripts/install_nginx.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install_nginx.sh b/scripts/install_nginx.sh index a9407229..d05a5ed5 100755 --- a/scripts/install_nginx.sh +++ b/scripts/install_nginx.sh @@ -1385,7 +1385,6 @@ function init_nginx_install() { run cp -f etc/nginx/nginx.conf /etc/nginx/ run cp -f etc/nginx/charset /etc/nginx/ - run cp -f etc/nginx/{comp_brotli,comp_gzip} /etc/nginx/ run cp -f etc/nginx/{fastcgi_cache,fastcgi_https_map,fastcgi_params,mod_pagespeed,proxy_cache,proxy_params} \ /etc/nginx/ run cp -f etc/nginx/{http_cloudflare_ips,http_proxy_ips,upstream} /etc/nginx/