mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 21:34:12 -07:00
nginx rate limit burst x2 and speed x2 installer + fix
This commit is contained in:
parent
761190755b
commit
5a87c64eaa
1 changed files with 24 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue