nginx rate limit burst x2 and speed x2 installer + fix

This commit is contained in:
myvesta 2020-05-22 00:25:13 +02:00 committed by GitHub
commit 5a87c64eaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,6 +14,24 @@ if [ "$grepc" -eq 0 ]; then
echo "=== Added rate_limit to nginx.conf" echo "=== Added rate_limit to nginx.conf"
fi 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.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/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 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.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/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 service nginx restart