diff --git a/src/deb/for-download/tools/rate-limit-tpl/install_rate_limit_tpl.sh b/src/deb/for-download/tools/rate-limit-tpl/install_rate_limit_tpl.sh index ac73de06..e97530f3 100644 --- a/src/deb/for-download/tools/rate-limit-tpl/install_rate_limit_tpl.sh +++ b/src/deb/for-download/tools/rate-limit-tpl/install_rate_limit_tpl.sh @@ -14,6 +14,24 @@ if [ "$grepc" -eq 0 ]; then echo "=== Added rate_limit to nginx.conf" fi +grepc=$(grep -c 'zone=addr:10m' /etc/nginx/nginx.conf) +if [ "$grepc" -eq 1 ]; then + sed -i 's|zone=addr:10m|zone=addr:1m|g' /etc/nginx/nginx.conf + echo "=== Decrease addr zone to 1mb to nginx.conf" +fi + +grepc=$(grep -c 'zone=one:10m' /etc/nginx/nginx.conf) +if [ "$grepc" -eq 1 ]; then + sed -i 's|zone=one:10m|zone=one:1m|g' /etc/nginx/nginx.conf + echo "=== Decrease one zone to 1mb to nginx.conf" +fi + +grepc=$(grep -c 'zone=two' /etc/nginx/nginx.conf) +if [ "$grepc" -eq 0 ]; then + sed -i 's|zone=one:1m rate=1r/s;|zone=one:1m rate=1r/s;\n limit_req_zone $binary_remote_addr zone=two:1m rate=2r/s;|g' /etc/nginx/nginx.conf + echo "=== Added rate_limit for 2 req/sec to nginx.conf" +fi + wget -nv -O /usr/local/vesta/data/templates/web/nginx/force-https-firewall.tpl http://c.myvestacp.com/tools/rate-limit-tpl/force-https-firewall.tpl wget -nv -O /usr/local/vesta/data/templates/web/nginx/force-https-firewall.stpl http://c.myvestacp.com/tools/rate-limit-tpl/force-https-firewall.stpl wget -nv -O /usr/local/vesta/data/templates/web/nginx/hosting-firewall.tpl http://c.myvestacp.com/tools/rate-limit-tpl/hosting-firewall.tpl @@ -26,4 +44,10 @@ wget -nv -O /usr/local/vesta/data/templates/web/nginx/hosting-firewall-burst-2.t wget -nv -O /usr/local/vesta/data/templates/web/nginx/hosting-firewall-burst-2.stpl http://c.myvestacp.com/tools/rate-limit-tpl/hosting-firewall-burst-2.stpl wget -nv -O /usr/local/vesta/data/templates/web/nginx/hosting-firewall-burst-2.sh http://c.myvestacp.com/tools/rate-limit-tpl/hosting-firewall-burst-2.sh +wget -nv -O /usr/local/vesta/data/templates/web/nginx/force-https-firewall-burst-2-speed-2.tpl http://c.myvestacp.com/tools/rate-limit-tpl/force-https-firewall-burst-2-speed-2.tpl +wget -nv -O /usr/local/vesta/data/templates/web/nginx/force-https-firewall-burst-2-speed-2.stpl http://c.myvestacp.com/tools/rate-limit-tpl/force-https-firewall-burst-2-speed-2.stpl +wget -nv -O /usr/local/vesta/data/templates/web/nginx/hosting-firewall-burst-2-speed-2.tpl http://c.myvestacp.com/tools/rate-limit-tpl/hosting-firewall-burst-2-speed-2.tpl +wget -nv -O /usr/local/vesta/data/templates/web/nginx/hosting-firewall-burst-2-speed-2.stpl http://c.myvestacp.com/tools/rate-limit-tpl/hosting-firewall-burst-2-speed-2.stpl +wget -nv -O /usr/local/vesta/data/templates/web/nginx/hosting-firewall-burst-2-speed-2.sh http://c.myvestacp.com/tools/rate-limit-tpl/hosting-firewall-burst-2-speed-2.sh + service nginx restart