From 759c9e54e94814cbc06530a4b0cd31f48854971e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=ACHE=20=D0=AFAW=20=E2=98=A3?= Date: Sun, 27 May 2018 01:51:01 +0200 Subject: [PATCH 01/11] Create README.md --- UBUNTU16/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 UBUNTU16/README.md diff --git a/UBUNTU16/README.md b/UBUNTU16/README.md new file mode 100644 index 0000000..b37663f --- /dev/null +++ b/UBUNTU16/README.md @@ -0,0 +1 @@ +` From 563575b3e0b359eed3e52ac9ac99cb9191409014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=ACHE=20=D0=AFAW=20=E2=98=A3?= Date: Sun, 27 May 2018 01:52:59 +0200 Subject: [PATCH 02/11] Update install --- install | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/install b/install index 0372f7e..7c325ba 100644 --- a/install +++ b/install @@ -204,6 +204,13 @@ case "`grep DISTRIB_CODENAME /etc/*-release | awk -F '=' '{print $2}'`" in service nginx start ;; + xenial) + apt update + apt upgrade -y + apt dist-upgrade -y + apt install build-essential libssl-dev curl nano wget zip unzip git htop iftop whois screen -y + ;; + centos) yum -y update; yum -y upgrade yum install epel-release wget curl git zip unzip -y From 382551fa7147c8433ea6fac0ea7d8b609c1e1a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=ACHE=20=D0=AFAW=20=E2=98=A3?= Date: Sun, 27 May 2018 01:53:26 +0200 Subject: [PATCH 03/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f7ed853..603199b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Another reason can be missing packages from your repository. if so please for Ub # To-Do - [x] Support Ubuntu Trusty. -- [ ] Support Ubuntu Xenial+. +- [x] Support Ubuntu Xenial. - [ ] Support Debian. - [ ] Support Centos. - [x] Support Arch Linux. From 088adec84c9ec65ab26aa11a50d04eaa111cf49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=ACHE=20=D0=AFAW=20=E2=98=A3?= Date: Sun, 27 May 2018 01:53:59 +0200 Subject: [PATCH 04/11] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 603199b..1a94704 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ Another reason can be missing packages from your repository. if so please for Ub # To-Do -- [x] Support Ubuntu Trusty. -- [x] Support Ubuntu Xenial. +- [x] Support Ubuntu Trusty. (14.04) +- [x] Support Ubuntu Xenial. (16.04) - [ ] Support Debian. - [ ] Support Centos. - [x] Support Arch Linux. From 0f0dce371f53c5329af881856794b8165f3daafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=ACHE=20=D0=AFAW=20=E2=98=A3?= Date: Sun, 27 May 2018 02:22:26 +0200 Subject: [PATCH 05/11] Update nbuild.sh --- static/nbuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/nbuild.sh b/static/nbuild.sh index 9bc2666..380e1a9 100644 --- a/static/nbuild.sh +++ b/static/nbuild.sh @@ -36,7 +36,7 @@ --with-stream_geoip_module \ --with-ld-opt="-Wl,-rpath,/usr/local/lib/" \ --add-module=/opt/nginx/modules/ngx_devel_kit \ ---add-module=/opt/nginx/modules/ngx_pagespeed-1.13.35.1-beta \ +--add-module=/opt/nginx/modules/ngx_pagespeed-1.13.35.2-stable \ --add-module=/opt/nginx/modules/testcookie-nginx-module \ --add-module=/opt/nginx/modules/set-misc-nginx-module \ --add-module=/opt/nginx/modules/headers-more-nginx-module \ From a265626037b2bc1ff7cae284207a8bc9daa55c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=ACHE=20=D0=AFAW=20=E2=98=A3?= Date: Sun, 27 May 2018 02:22:52 +0200 Subject: [PATCH 06/11] Update nbuild.sh --- static/nbuild.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/static/nbuild.sh b/static/nbuild.sh index 380e1a9..4190b42 100644 --- a/static/nbuild.sh +++ b/static/nbuild.sh @@ -44,7 +44,6 @@ --add-module=/opt/nginx/modules/ngx_cache_purge \ --add-module=/opt/nginx/modules/ngx_http_geoip2_module \ --add-module=/opt/nginx/modules/lua-nginx-module \ ---add-module=/opt/nginx/modules/nginx-mtask-module \ --add-module=/opt/nginx/modules/ModSecurity-nginx \ --add-module=/opt/nginx/modules/encrypted-session-nginx-module \ --add-module=/opt/nginx/modules/naxsi/naxsi_src/ \ From 447524a3448374fc8442ed1deaee31a3b0ad3bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=ACHE=20=D0=AFAW=20=E2=98=A3?= Date: Sun, 27 May 2018 02:39:29 +0200 Subject: [PATCH 07/11] Create nginx.service --- UBUNTU16/nginx.service | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 UBUNTU16/nginx.service diff --git a/UBUNTU16/nginx.service b/UBUNTU16/nginx.service new file mode 100644 index 0000000..fcf4141 --- /dev/null +++ b/UBUNTU16/nginx.service @@ -0,0 +1,16 @@ +[Unit] +Description=A high performance web server and a reverse proxy server +After=network.target + +[Service] +Type=forking +PIDFile=/var/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 From 51e69c046468329c680d0fe08c06158cfac8ba70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=ACHE=20=D0=AFAW=20=E2=98=A3?= Date: Sun, 27 May 2018 02:46:12 +0200 Subject: [PATCH 08/11] Update nginx.service --- UBUNTU16/nginx.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UBUNTU16/nginx.service b/UBUNTU16/nginx.service index fcf4141..b18c12b 100644 --- a/UBUNTU16/nginx.service +++ b/UBUNTU16/nginx.service @@ -4,7 +4,7 @@ After=network.target [Service] Type=forking -PIDFile=/var/run/nginx.pid +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 From 5a69e2591f92a0a58f9dbcd99bb76af4e69c55e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=ACHE=20=D0=AFAW=20=E2=98=A3?= Date: Sun, 27 May 2018 02:49:11 +0200 Subject: [PATCH 09/11] Update install --- install | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 175 insertions(+), 1 deletion(-) diff --git a/install b/install index 7c325ba..0078bd8 100644 --- a/install +++ b/install @@ -205,10 +205,184 @@ case "`grep DISTRIB_CODENAME /etc/*-release | awk -F '=' '{print $2}'`" in ;; xenial) + + if [ "$(whoami)" != "root" ] + then + echo "You should Login as root to use this script!"; + echo "May you already have access for sudo, but commands aren't designed with sudo! so.."; + echo "sudo -i"; + exit 1 + fi + + if [ -d "/nginx/" ]; then + echo "We've detect a folder '/nginx/' which means" + echo "Maybe you have use this script before!" + echo "You can fix this by executing!" + echo "./setup clean" + exit 1 + fi + + if [ -d "/etc/nginx" ]; then + echo "We've detect a folder '/etc/nginx' which means" + echo "Maybe you have use this script before!" + echo "./setup clean" + exit 1 + fi + + if [ -d "/opt/nginx/" ]; then + echo "We've detect a folder '/opt/nginx/' which means" + echo "Maybe you have use this script before!" + echo "./setup clean" + exit 1 + fi + apt update apt upgrade -y apt dist-upgrade -y - apt install build-essential libssl-dev curl nano wget zip unzip git htop iftop whois screen -y + apt install build-essential apt-utils libssl-dev curl nano wget zip unzip git htop iftop whois screen -y + apt purge --remove nginx -y + apt purge --remove apache2 -y + apt autoremove -y + + cd ~/; + wget https://raw.githubusercontent.com/systemroot/my-nginx/master/nginx-as-firewall/setup + chmod +x setup + ./setup clean + rm -Rf ~/setup + + apt install -y checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg libxml2 zlib1g-dev + apt install -y libicu-dev libcurl4-gnutls-dev libtool + apt install -y libmozjs-24-dev + apt install -y libmozjs-24-bin; sudo ln -sf /usr/bin/js24 /usr/bin/js + apt install openssl libssl-dev libperl-dev libexpat-dev -y + apt install mercurial meld -y + apt install libxslt-dev -y + apt install libgd2-xpm -y + apt install libgd2-xpm-dev -y + apt install libgeoip-dev -y + apt install dh-autoreconf -y + apt install -y software-properties-common + apt install -y python-software-properties + apt install -y libcairo2 libcairo2-dev + apt install -y python-dev + sudo add-apt-repository ppa:maxmind/ppa -y + apt update; apt upgrade -y; apt dist-upgrade -y + apt install aptitude -y + aptitude update -y + aptitude upgrade -y + aptitude install libmaxminddb0 libmaxminddb-dev mmdb-bin -y + apt install libmysqlclient-dev -y + apt install libmariadbclient-dev -y + apt install g++ flex bison curl doxygen libyajl-dev libgeoip-dev libtool dh-autoreconf libcurl4-gnutls-dev libxml2 libpcre++-dev libxml2-dev -y + apt install libuuid1 uuid-dev -y + + mkdir -p /hostdata/ + mkdir -p /var/log/nginx/ + mkdir -p /opt/nginx/modules/ + + cd /opt/ + git clone https://github.com/SpiderLabs/ModSecurity + cd /opt/ModSecurity/ + git checkout -b v3/master origin/v3/master + sh build.sh + git submodule init + git submodule update + ./configure + make -j`nproc` + make install + + cd /opt/nginx/modules/ + wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.1rc1.zip + unzip v0.3.1rc1.zip; rm -Rf v0.3.1rc1.zip + mv /opt/nginx/modules/ngx_devel_kit-0.3.1rc1/ /opt/nginx/modules/ngx_devel_kit/ + + cd /opt/nginx/modules/ + wget https://github.com/apache/incubator-pagespeed-ngx/archive/v1.13.35.2-stable.zip + unzip v1.13.35.2-stable.zip + rm -Rf v1.13.35.2-stable.zip + mv /opt/nginx/modules/incubator-pagespeed-ngx-1.13.35.2-stable /opt/nginx/modules/ngx_pagespeed-1.13.35.2-stable + cd /opt/nginx/modules/ngx_pagespeed-1.13.35.2-stable + wget https://dl.google.com/dl/page-speed/psol/1.13.35.2-x64.tar.gz + tar -xzvf 1.13.35.2-x64.tar.gz; rm -Rf 1.13.35.2-x64.tar.gz + + #LuaJIT Library + cd /opt/nginx/modules/ + git clone http://luajit.org/git/luajit-2.0.git + cd luajit-2.0/ + make -j`nproc` + sudo make install + ldconfig + + cd /opt/nginx/modules/ + wget https://github.com/nbs-system/naxsi/archive/master.zip + unzip master.zip; rm -Rf master.zip + mv /opt/nginx/modules/naxsi-master /opt/nginx/modules/naxsi + + mkdir -p /opt/nginx/modules/ + cd /opt/nginx/modules/ + rm -Rf nginx_redis/ + git clone https://github.com/openresty/set-misc-nginx-module.git + git clone https://github.com/FRiCKLE/ngx_cache_purge.git + git clone https://github.com/kyprizel/testcookie-nginx-module.git + git clone https://github.com/openresty/headers-more-nginx-module.git + git clone https://github.com/openresty/echo-nginx-module.git + git clone https://github.com/leev/ngx_http_geoip2_module.git + git clone https://github.com/openresty/lua-nginx-module.git + git clone https://github.com/SpiderLabs/ModSecurity-nginx.git + git clone https://github.com/openresty/encrypted-session-nginx-module.git + git clone https://github.com/flant/nginx-http-rdns.git + + # Download Nginx + mkdir -p /opt/nginx/sources/ + cd /opt/nginx/sources/ + wget 'http://nginx.org/download/nginx-1.14.0.tar.gz' + tar -xzvf nginx-1.14.0.tar.gz; rm -Rf nginx-1.14.0.tar.gz + cd /opt/nginx/sources/nginx-1.14.0/ + wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/nbuild.sh + chmod +x nbuild.sh + ./nbuild.sh + make -j`nproc` + make install + ldconfig + + mkdir -p /nginx/live + mkdir -p /nginx/logs + mkdir -p /nginx/conf.d + touch /nginx/logs/access.log + touch /nginx/logs/error.log + useradd -r nginx + rm -Rf /etc/init.d/nginx + cd /etc/init.d/; wget https://raw.githubusercontent.com/systemroot/my-nginx/master/nginx-as-firewall/static/nginx + chmod +x /etc/init.d/nginx + cd /nginx/; mkdir conf.d; rm -Rf nginx.conf*; wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/nginx.conf + cd /nginx/live/ + wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/vhost/default + + mkdir -p /hostdata/default + mkdir -p /hostdata/default/public_html + mkdir -p /hostdata/default/logs + mkdir -p /hostdata/default/cache + mkdir -p /nginx/modsecurity/ + cd /hostdata/default/public_html/ + wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/html/index.html + sudo update-rc.d nginx defaults + + cd /nginx/; mkdir db/; cd db/; wget https://github.com/theraw/The-World-Is-Yours/raw/master/static/GeoLite2-Country.mmdb + cd /nginx/; rm -Rf *.default + cp /opt/nginx/modules/naxsi/naxsi_config/naxsi_core.rules /nginx/naxsi_core.rules + cp /opt/ModSecurity/modsecurity.conf-recommended /nginx/modsecurity/modsecurity.conf + + cd /opt/; git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git + cp -a /opt/owasp-modsecurity-crs/rules/ /nginx/modsecurity/ + cp -a /opt/owasp-modsecurity-crs/crs-setup.conf.example /nginx/modsecurity/crs-setup.conf + clear + cd /etc/systemd/system/; wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/theraw-patch-1/UBUNTU16/nginx.service + sudo systemctl start nginx.service && sudo systemctl enable nginx.service + killall nginx + systemctl daemon-reload + service nginx stop + service nginx start + ;; centos) From 7c56ed0db346b1ca81f8f8f9825c19ae7d564465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=ACHE=20=D0=AFAW=20=E2=98=A3?= Date: Sun, 27 May 2018 02:50:24 +0200 Subject: [PATCH 10/11] Update install --- install | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/install b/install index 0078bd8..7ae566f 100644 --- a/install +++ b/install @@ -87,11 +87,6 @@ case "`grep DISTRIB_CODENAME /etc/*-release | awk -F '=' '{print $2}'`" in ./configure make -j`nproc` make install - - #cd /opt/nginx/modules/ - #git clone https://github.com/ildus/nginx_redis.git - #cd nginx_redis/ - #mv ngx_devel_kit-0.2.19/ /opt/nginx/modules/ cd /opt/nginx/modules/ wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.1rc1.zip @@ -100,14 +95,13 @@ case "`grep DISTRIB_CODENAME /etc/*-release | awk -F '=' '{print $2}'`" in #Pagespeed Library cd /opt/nginx/modules/ - wget https://github.com/pagespeed/ngx_pagespeed/archive/v1.13.35.1-beta.zip - unzip v1.13.35.1-beta.zip - rm -Rf v1.13.35.1-beta.zip - - mv /opt/nginx/modules/incubator-pagespeed-ngx-1.13.35.1-beta /opt/nginx/modules/ngx_pagespeed-1.13.35.1-beta - cd /opt/nginx/modules/ngx_pagespeed-1.13.35.1-beta - wget https://dl.google.com/dl/page-speed/psol/1.13.35.1-x64.tar.gz - tar -xzvf 1.13.35.1-x64.tar.gz; rm -Rf 1.13.35.1-x64.tar.gz + wget https://github.com/apache/incubator-pagespeed-ngx/archive/v1.13.35.2-stable.zip + unzip v1.13.35.2-stable.zip + rm -Rf v1.13.35.2-stable.zip + mv /opt/nginx/modules/incubator-pagespeed-ngx-1.13.35.2-stable /opt/nginx/modules/ngx_pagespeed-1.13.35.2-stable + cd /opt/nginx/modules/ngx_pagespeed-1.13.35.2-stable + wget https://dl.google.com/dl/page-speed/psol/1.13.35.2-x64.tar.gz + tar -xzvf 1.13.35.2-x64.tar.gz; rm -Rf 1.13.35.2-x64.tar.gz #LuaJIT Library cd /opt/nginx/modules/ From b1bcb1bf916b473d841850843c6bae63b975033b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C6=ACHE=20=D0=AFAW=20=E2=98=A3?= Date: Sun, 27 May 2018 02:52:34 +0200 Subject: [PATCH 11/11] Update install --- install | 3 --- 1 file changed, 3 deletions(-) diff --git a/install b/install index 7ae566f..386563b 100644 --- a/install +++ b/install @@ -144,10 +144,8 @@ case "`grep DISTRIB_CODENAME /etc/*-release | awk -F '=' '{print $2}'`" in make install ldconfig - mkdir -p /nginx mkdir -p /nginx/live mkdir -p /nginx/logs - mkdir -p /nginx/cache mkdir -p /nginx/conf.d touch /nginx/logs/access.log touch /nginx/logs/error.log @@ -167,7 +165,6 @@ case "`grep DISTRIB_CODENAME /etc/*-release | awk -F '=' '{print $2}'`" in mkdir -p /nginx/modsecurity/ cd /hostdata/default/public_html/ wget https://raw.githubusercontent.com/theraw/The-World-Is-Yours/master/static/html/index.html - useradd nginx sudo update-rc.d nginx defaults cd /nginx/; mkdir db/; cd db/; wget https://github.com/theraw/The-World-Is-Yours/raw/master/static/GeoLite2-Country.mmdb