mirror of
https://github.com/joglomedia/LEMPer.git
synced 2026-04-13 08:28:21 +00:00
Merge branch 'master' of https://github.com/joglomedia/LEMPer
Removed unused files
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Remove Apache2 & mysql services if exist
|
||||
|
||||
if [[ -n $(which apache2) ]]; then
|
||||
echo "Uninstall existing Apache web server..."
|
||||
killall -9 apache2
|
||||
service apache2 stop
|
||||
apt-get --purge remove -y apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker
|
||||
fi
|
||||
|
||||
if [[ -n $(which mysql) ]]; then
|
||||
echo "Uninstall existing MySQL database server..."
|
||||
killall -9 mysql
|
||||
service mysqld stop
|
||||
apt-get --purge remove -y mysql-client mysql-server mysql-common
|
||||
fi
|
||||
|
||||
apt-get autoremove -y
|
||||
@@ -1,211 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Nginx from Source installer
|
||||
# Min requirement : GNU/Linux Ubuntu 14.04 & 16.04
|
||||
# Last Build : 17/11/2018
|
||||
# Author : ESLabs.id (eslabs.id@gmail.com)
|
||||
|
||||
# Make sure only root can run this installer script
|
||||
if [ $(id -u) -ne 0 ]; then
|
||||
echo "This script must be run as root..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
apt update && apt upgrade -y
|
||||
apt install build-essential git wget -y
|
||||
|
||||
## Dependencies ##
|
||||
|
||||
# PCRE version 4.4 - 8.40
|
||||
wget https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz && \
|
||||
tar xzvf pcre-8.42.tar.gz && \
|
||||
rm -f pcre-8.42.tar.gz
|
||||
|
||||
# zlib version 1.1.3 - 1.2.11
|
||||
wget http://www.zlib.net/zlib-1.2.11.tar.gz && \
|
||||
tar xzvf zlib-1.2.11.tar.gz && \
|
||||
rm -f zlib-1.2.11.tar.gz
|
||||
|
||||
# OpenSSL version 1.0.2 - 1.1.0
|
||||
wget https://www.openssl.org/source/openssl-1.1.0i.tar.gz && \
|
||||
tar xzvf openssl-1.1.0i.tar.gz && \
|
||||
rm -f openssl-1.1.0i.tar.gz
|
||||
|
||||
## Nginx sources ##
|
||||
wget https://nginx.org/download/nginx-1.14.1.tar.gz && \
|
||||
tar zxvf nginx-1.14.1.tar.gz && \
|
||||
nginx-1.14.1.tar.gz
|
||||
|
||||
## Nginx modules ##
|
||||
|
||||
mkdir modules
|
||||
cd modules
|
||||
|
||||
# FastCGI cache purge
|
||||
wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz && \
|
||||
tar zxvf ngx_cache_purge-2.3.tar.gz && \
|
||||
rm -f ngx_cache_purge-2.3.tar.gz
|
||||
|
||||
git clone https://github.com/sto/ngx_http_auth_pam_module.git
|
||||
|
||||
git clone https://github.com/arut/nginx-dav-ext-module.git
|
||||
|
||||
git clone https://github.com/openresty/echo-nginx-module.git
|
||||
|
||||
git clone https://github.com/gnosek/nginx-upstream-fair.git
|
||||
|
||||
git clone git://github.com/yaoweibin/ngx_http_substitutions_filter_module.git
|
||||
|
||||
# PageSpeed
|
||||
git clone https://github.com/apache/incubator-pagespeed-ngx.git
|
||||
|
||||
# PubSub server
|
||||
git clone https://github.com/slact/nchan.git
|
||||
|
||||
# Naxi Web Application Firewall
|
||||
git clone https://github.com/nbs-system/naxsi.git
|
||||
|
||||
# Fancy Index
|
||||
git clone https://github.com/aperezdc/ngx-fancyindex.git
|
||||
|
||||
# Handle Upload
|
||||
git clone https://github.com/fdintino/nginx-upload-module.git
|
||||
git clone https://github.com/masterzen/nginx-upload-progress-module.git
|
||||
|
||||
# VHost traffic status
|
||||
git clone https://github.com/vozlt/nginx-module-vts.git
|
||||
|
||||
cd ../
|
||||
|
||||
## Configure Nginx ##
|
||||
|
||||
cd nginx-1.14.1
|
||||
|
||||
./configure --prefix=/usr/share/nginx \
|
||||
--sbin-path=/usr/sbin/nginx \
|
||||
--modules-path=/usr/lib/nginx/modules \
|
||||
--conf-path=/etc/nginx/nginx.conf \
|
||||
--error-log-path=/var/log/nginx/error.log \
|
||||
--http-log-path=/var/log/nginx/access.log \
|
||||
--pid-path=/run/nginx.pid \
|
||||
--lock-path=/var/lock/nginx.lock \
|
||||
--user=www-data \
|
||||
--group=www-data \
|
||||
--build=Ubuntu \
|
||||
--http-client-body-temp-path=/var/lib/nginx/body \
|
||||
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
|
||||
--http-proxy-temp-path=/var/lib/nginx/proxy \
|
||||
--http-scgi-temp-path=/var/lib/nginx/scgi \
|
||||
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
|
||||
--with-openssl=../openssl-1.1.0i \
|
||||
--with-openssl-opt=enable-ec_nistp_64_gcc_128 \
|
||||
--with-openssl-opt=no-nextprotoneg \
|
||||
--with-openssl-opt=no-weak-ssl-ciphers \
|
||||
--with-openssl-opt=no-ssl3 \
|
||||
--with-pcre=../pcre-8.42 \
|
||||
--with-pcre-jit \
|
||||
--with-zlib=../zlib-1.2.11 \
|
||||
--with-compat \
|
||||
--with-file-aio \
|
||||
--with-threads \
|
||||
--with-http_addition_module \
|
||||
--with-http_auth_request_module \
|
||||
--with-http_dav_module \
|
||||
--with-http_flv_module \
|
||||
--with-http_gunzip_module \
|
||||
--with-http_gzip_static_module \
|
||||
--with-http_mp4_module \
|
||||
--with-http_random_index_module \
|
||||
--with-http_realip_module \
|
||||
--with-http_slice_module \
|
||||
--with-http_ssl_module \
|
||||
--with-http_sub_module \
|
||||
--with-http_stub_status_module \
|
||||
--with-http_v2_module \
|
||||
--with-http_secure_link_module \
|
||||
--with-http_geoip_module=dynamic \
|
||||
--with-http_image_filter_module=dynamic \
|
||||
--with-http_xslt_module=dynamic \
|
||||
--with-mail=dynamic \
|
||||
--with-mail_ssl_module \
|
||||
--with-stream=dynamic \
|
||||
--with-stream_realip_module \
|
||||
--with-stream_ssl_module \
|
||||
--with-stream_ssl_preread_module \
|
||||
--with-debug \
|
||||
--with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' \
|
||||
--with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' \
|
||||
--add-dynamic-module=../modules/ngx_http_auth_pam_module \
|
||||
--add-dynamic-module=../modules/nginx-dav-ext-module \
|
||||
--add-dynamic-module=../modules/echo-nginx-module \
|
||||
--add-dynamic-module=../modules/nginx-upstream-fair \
|
||||
--add-dynamic-module=../modules/ngx_http_substitutions_filter_module \
|
||||
--add-dynamic-module=../modules/ngx_cache_purge-2.3 \
|
||||
--add-dynamic-module=../modules/incubator-pagespeed-ngx
|
||||
|
||||
make && \
|
||||
make install
|
||||
|
||||
mkdir -p /var/lib/nginx && \
|
||||
nginx -t
|
||||
|
||||
# Systemd unit file for NGINX
|
||||
cat > /lib/systemd/system/nginx.service <<EOL
|
||||
# Stop dance for nginx
|
||||
# =======================
|
||||
#
|
||||
# ExecStop sends SIGSTOP (graceful stop) to the nginx process.
|
||||
# If, after 5s (--retry QUIT/5) nginx is still running, systemd takes control
|
||||
# and sends SIGTERM (fast shutdown) to the main process.
|
||||
# After another 5s (TimeoutStopSec=5), and if nginx is alive, systemd sends
|
||||
# SIGKILL to all the remaining processes in the process group (KillMode=mixed).
|
||||
#
|
||||
# nginx signals reference doc:
|
||||
# http://nginx.org/en/docs/control.html
|
||||
#
|
||||
[Unit]
|
||||
Description=A high performance web server and a reverse proxy server
|
||||
Documentation=man:nginx(8)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/run/nginx.pid
|
||||
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
|
||||
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
|
||||
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
|
||||
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
|
||||
TimeoutStopSec=5
|
||||
KillMode=mixed
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOL
|
||||
|
||||
# Start and enable NGINX service:
|
||||
systemctl start nginx.service && \
|
||||
systemctl enable nginx.service
|
||||
|
||||
# Check if NGINX will startup after a reboot:
|
||||
#sudo systemctl is-enabled nginx.service
|
||||
|
||||
# Create UFW NGINX application profile:
|
||||
cat > /etc/ufw/applications.d/nginx <<EOL
|
||||
[Nginx HTTP]
|
||||
title=Web Server (Nginx, HTTP)
|
||||
description=Small, but very powerful and efficient web server
|
||||
ports=80/tcp
|
||||
|
||||
[Nginx HTTPS]
|
||||
title=Web Server (Nginx, HTTPS)
|
||||
description=Small, but very powerful and efficient web server
|
||||
ports=443/tcp
|
||||
|
||||
[Nginx Full]
|
||||
title=Web Server (Nginx, HTTP + HTTPS)
|
||||
description=Small, but very powerful and efficient web server
|
||||
ports=80,443/tcp
|
||||
EOL
|
||||
|
||||
# Verify that UFW app profiles are created and recognized
|
||||
sudo ufw app list
|
||||
@@ -1,145 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# +------------------------------------------------------------------------+
|
||||
# | NgxVhost - Simple Nginx vHost Configs File Generator |
|
||||
# +------------------------------------------------------------------------+
|
||||
# | Copyright (c) 2014-2019 NgxTools (https://ngxtools.eslabs.id) |
|
||||
# +------------------------------------------------------------------------+
|
||||
# | This source file is subject to the New BSD License that is bundled |
|
||||
# | with this package in the file docs/LICENSE.txt. |
|
||||
# | |
|
||||
# | If you did not receive a copy of the license and are unable to |
|
||||
# | obtain it through the world-wide-web, please send an email |
|
||||
# | to license@eslabs.id so we can send you a copy immediately. |
|
||||
# +------------------------------------------------------------------------+
|
||||
# | Authors: Edi Septriyanto <eslabs.id@gmail.com> |
|
||||
# +------------------------------------------------------------------------+
|
||||
|
||||
# Version Control
|
||||
APPNAME="ngxrmvhost"
|
||||
VERSION="1.5.0-beta"
|
||||
|
||||
# May need to run this as sudo!
|
||||
# I have it in /usr/local/bin and run command 'ngxvhost' from anywhere, using sudo.
|
||||
if [ $(id -u) -ne 0 ]; then
|
||||
echo "You must be root: 'sudo $APPNAME'" >&2
|
||||
exit 1 #error
|
||||
fi
|
||||
|
||||
# Help
|
||||
function show_usage {
|
||||
cat <<- _EOF_
|
||||
$APPNAME, enable/disable/remove Nginx vHost config file in Ubuntu Server.
|
||||
|
||||
Requirements:
|
||||
Nginx with /etc/nginx/sites-available and /etc/nginx/sites-enabled setup used.
|
||||
|
||||
Usage:
|
||||
$APPNAME [OPTION]...
|
||||
|
||||
Options:
|
||||
-e, --enable enable vhost
|
||||
-d, --disable disable vhost
|
||||
-r, --remove remove vhost
|
||||
|
||||
-h, --help display this help and exit
|
||||
-V, --version output version information and exit
|
||||
|
||||
Example:
|
||||
$APPNAME --remove example.com
|
||||
|
||||
For more details visit http://masedi.net.
|
||||
Mail bug reports and suggestions to <hi@masedi.net>.
|
||||
_EOF_
|
||||
}
|
||||
|
||||
#ngxrmvhost --enable vhost
|
||||
function enable_vhost {
|
||||
# Enable Nginx's vhost config.
|
||||
if [[ ! -f "/etc/nginx/sites-enabled/$1.conf" && -f "/etc/nginx/sites-available/$1.conf" ]]; then
|
||||
ln -s /etc/nginx/sites-available/$1.conf /etc/nginx/sites-enabled/$1.conf
|
||||
|
||||
# Reload Nginx.
|
||||
service nginx reload -s
|
||||
echo "Your site $1 has been enabled..."
|
||||
else
|
||||
echo "Sorry, we can't find $1. Probably, it has been enabled or not yet created..."
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
#ngxvhost --disable vhost
|
||||
function disable_vhost {
|
||||
# Disable Nginx's vhost config.
|
||||
if [ -f "/etc/nginx/sites-enabled/$1.conf" ]; then
|
||||
unlink /etc/nginx/sites-enabled/$1.conf
|
||||
|
||||
# Reload Nginx.
|
||||
service nginx reload -s
|
||||
echo "Your site $1 has been disabled..."
|
||||
else
|
||||
echo "Sorry, we can't find $1. Probably, it has been disabled or removed..."
|
||||
fi
|
||||
exit 0 #success
|
||||
}
|
||||
|
||||
#ngxvhost --remove sitename
|
||||
function remove_vhost {
|
||||
# Remove Nginx's vhost config.
|
||||
if [ -f "/etc/nginx/sites-available/$1.conf" ]; then
|
||||
echo "Sorry, we can't find Nginx config for $1..."
|
||||
else
|
||||
unlink /etc/nginx/sites-enabled/$1.conf
|
||||
rm -f /etc/nginx/sites-available/$1.conf
|
||||
|
||||
# Remove vhost root directory.
|
||||
echo -n "Do you want to delete website root directory? (Y/n): "; read isdeldir
|
||||
if [[ "${isdeldir}" = "Y" || "${isdeldir}" = "y" || "${isdeldir}" = "yes" ]]; then
|
||||
echo -n "Enter the real path to website root directory: "; read sitedir
|
||||
rm -fr ${sitedir}
|
||||
fi
|
||||
|
||||
# Drop MySQL database.
|
||||
echo -n "Do you want to Drop database associated to this website? (Y/n): "; read isdropdb
|
||||
if [[ "${isdropdb}" = "Y" || "${isdropdb}" = "y" || "${isdropdb}" = "yes" ]]; then
|
||||
echo -n "MySQL username: "; read username
|
||||
echo -n "MySQL password: "; stty -echo; read password; stty echo; echo
|
||||
sleep 1
|
||||
echo "Starting to drop database, please select your database name!"
|
||||
echo -n "MySQL database: "; read dbname
|
||||
|
||||
mysql -u $username -p"$password" -e "DROP DATABASE $dbname"
|
||||
fi
|
||||
|
||||
# Reload Nginx.
|
||||
service nginx reload -s
|
||||
echo "Your site $1 has been removed..."
|
||||
fi
|
||||
exit 0 #success
|
||||
}
|
||||
|
||||
# Sanity Check - are there an arguments with value?
|
||||
|
||||
#getopt
|
||||
OPTS=`getopt -o Vhe:d:r: -l help,version,enable:,disable:,remove: -- "$@"`
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
echo "Terminating..." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h | --help) show_usage; exit 0; shift;;
|
||||
-e | --enable) enable_vhost $2; shift 2;;
|
||||
-d | --disable) disable_vhost $2; shift 2;;
|
||||
-r | --remove) remove_vhost $2; shift 2;;
|
||||
-V | --version) echo "$APPNAME version $VERSION"; exit 1; shift;;
|
||||
--) shift; break;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "$APPNAME: missing optstring argument"
|
||||
echo "Try '$APPNAME --help' for more information."
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Remove Apache2 & mysql services if exist
|
||||
|
||||
if [[ -n $(which apache2) ]]; then
|
||||
echo "Uninstall existing Apache web server..."
|
||||
killall -9 apache2
|
||||
apt-get --purge remove -y apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker
|
||||
fi
|
||||
|
||||
if [[ -n $(which mysql) ]]; then
|
||||
echo "Uninstall existing MySQL database server..."
|
||||
killall -9 mysql
|
||||
apt-get --purge remove -y mysql-client mysql-server mysql-common
|
||||
fi
|
||||
|
||||
apt-get autoremove -y
|
||||
Reference in New Issue
Block a user