{"id":904,"date":"2016-12-07T15:31:51","date_gmt":"2016-12-07T14:31:51","guid":{"rendered":"http:\/\/ndk.sytes.net\/wordpress\/?p=904"},"modified":"2016-12-07T15:31:51","modified_gmt":"2016-12-07T14:31:51","slug":"limit-per-request-bandwidth-using-apache-2-4","status":"publish","type":"post","link":"https:\/\/ndk.sytes.net\/wordpress\/?p=904","title":{"rendered":"Limit per request bandwidth using Apache 2.4"},"content":{"rendered":"<p>\n\tApache 2.4 has a module called mod_ratelimit. This module gives you the ability to limit the bandwidth of your requests posted to the web server. The usage is quite simple (<a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_ratelimit.html\" target=\"_blank\">read the docs<\/a>):\n<\/p>\n<p>\n\tFirst load the module (Apache 2.4 on FreeBSD). Uncomment following line in \/usr\/local\/etc\/apache24\/httpd.conf\n<\/p>\n<pre>\nLoadModule ratelimit_module libexec\/apache24\/mod_ratelimit.so<\/pre>\n<p>\n\tThis will load the module during next startup. Now how do i use it? Well, let&#39;s say you want the whole server to limit every request to 5MB\/s, then&nbsp;use this:\n<\/p>\n<pre>\n&lt;IfModule mod_ratelimit.c&gt;\n    SetOutputFilter RATE_LIMIT\n    SetEnv rate-limit 5120\n&lt;\/IfModule&gt;<\/pre>\n<p>\n\tThe same can be applied to only specific directories if you need to:\n<\/p>\n<pre>\n&lt;IfModule mod_ratelimit.c&gt;\n    &lt;Location &quot;\/downloads&quot;&gt;\n        SetOutputFilter RATE_LIMIT\n        SetEnv rate-limit 5120\n    &lt;\/Location&gt;\n&lt;\/IfModule&gt;<\/pre>\n<p>\n\tLast step, as apache needs to load a new module,&nbsp;restart your webserver, not reload:\n<\/p>\n<pre>\n# service apache24 restart\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Apache 2.4 has a module called mod_ratelimit. This module gives you the ability to limit the bandwidth of your requests posted to the web server. The usage is quite simple (read the docs): First load the module (Apache 2.4 on FreeBSD). Uncomment following line in \/usr\/local\/etc\/apache24\/httpd.conf LoadModule ratelimit_module libexec\/apache24\/mod_ratelimit.so This will load the module during [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,7],"tags":[],"class_list":["post-904","post","type-post","status-publish","format-standard","hentry","category-linuxunix","category-servers"],"_links":{"self":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=904"}],"version-history":[{"count":0,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/904\/revisions"}],"wp:attachment":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}