#!/usr/bin/env bash
# LEMPer administration installer
# Min. Requirement : GNU/Linux Ubuntu 14.04
# Last Build : 01/07/2019
# Author : ESLabs.ID (eslabs.id@gmail.com)
# Since Version : 1.0.0
# Include decorator
if [ "$(type -t run)" != "function" ]; then
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )
. ${BASEDIR}/helper.sh
fi
# Make sure only root can run this installer script
if [ $(id -u) -ne 0 ]; then
error "You need to be root to run this script"
exit 1
fi
echo -e "\nInstalling web administration tools...\n"
function create_index_file() {
cat <<- _EOF_
Welcome to nginx!
Welcome to nginx!
If you see this page, the nginx web server is successfully installed using LEMPer. Further configuration is required.
For online documentation and support please refer to
nginx.org.
LEMPer and ngxTools support is available at
LEMPer git.
Thank you for using nginx, ngxTools, and LEMPer.
Generated using LEMPer from Nginx vHost Tool, a simple nginx web server management tool.
_EOF_
}
# Install Nginx vHost Creator
run cp -f scripts/ngxvhost.sh /usr/local/bin/ngxvhost
run cp -f scripts/ngxtool.sh /usr/local/bin/ngxtool
run chmod ugo+x /usr/local/bin/ngxvhost
run chmod ugo+x /usr/local/bin/ngxtool
# Install Web-viewer Tools
run mkdir /usr/share/nginx/html/tools/
create_index_file > /usr/share/nginx/html/index.html
create_index_file > /usr/share/nginx/html/tools/index.html
# Install PHP Info
#cat > /usr/share/nginx/html/tools/phpinfo.php <
#EOL
run bash -c 'echo "" > /usr/share/nginx/html/tools/phpinfo.php'
run bash -c 'echo "" > /usr/share/nginx/html/tools/phpinfo.php56'
run bash -c 'echo "" > /usr/share/nginx/html/tools/phpinfo.php70'
run bash -c 'echo "" > /usr/share/nginx/html/tools/phpinfo.php71'
run bash -c 'echo "" > /usr/share/nginx/html/tools/phpinfo.php72'
# Install Zend OpCache Web Viewer
run wget -q --no-check-certificate https://raw.github.com/rlerdorf/opcache-status/master/opcache.php -O /usr/share/nginx/html/tools/opcache.php
# Install Memcache Web-based stats
#http://blog.elijaa.org/index.php?pages/phpMemcachedAdmin-Installation-Guide
run git clone https://github.com/elijaa/phpmemcachedadmin.git /usr/share/nginx/html/tools/phpMemcachedAdmin/
# Install Adminer for Web-based MySQL Administration Tool
run mkdir /usr/share/nginx/html/tools/adminer/
run wget -q --no-check-certificate https://github.com/vrana/adminer/releases/download/v4.7.1/adminer-4.7.1.php -O /usr/share/nginx/html/tools/adminer/index.php
run wget -q --no-check-certificate https://github.com/vrana/adminer/releases/download/v4.7.1/editor-4.7.1.php -O /usr/share/nginx/html/tools/adminer/editor.php
# Install FileRun File Manager
run mkdir /usr/share/nginx/html/tools/filerun/
run wget -q http://www.filerun.com/download-latest -O FileRun.zip
run unzip -qq FileRun.zip -d /usr/share/nginx/html/tools/filerun/
run rm -f FileRun.zip
# TODO: try Tinyfilemanager https://github.com/prasathmani/tinyfilemanager
# Assign ownership properly
run chown -hR www-data:root /usr/share/nginx/html/tools/
if [[ -x /usr/local/bin/ngxvhost && -x /usr/local/bin/ngxtool && -d /usr/share/nginx/html/tools ]]; then
status -e "\nWeb administration tools successfully installed.\n"
fi