i'm building a website free for download but i want to limit bandwidth per user !!!. Maybe user A cant download 2Gb per day etc.... :eek: :eek: And suggest me I have to use Apache download or FTP download !! I think Apache is not good for user management !!! :rolleyes: :rolleyes:
pls help
thanks in advanced !!

Dani AI

Generated

Short answer for : you can enforce a per-user byte quota (e.g. 2 GB/day), but you need either (A) a server that keeps per-user tallies and enforces limits (FTP or a quota-capable Apache module) or (B) application-level accounting that checks and then hands the file off to the webserver. was right to point out that many Apache modules only throttle speed; for a true "X GB per day" cap you need tallying and a reset mechanism.

If you prefer FTP: ProFTPD supports byte/file quota tables (limits + tallies) via mod_quotatab and its drivers; the tally is updated on RETR/STOR and can be reset/managed with the supplied ftpquota tools (cron-reset for daily quotas). This is a clean, built-in way to give each FTP account a hard daily transfer cap. (sources.debian.org)

If you want to stay on HTTP/Apache: mod_cband is one Apache option that can enforce per-user/virtualhost transfer limits over a period (CBandLimit/CBandPeriod, etc.), but it is older and sometimes requires building and careful testing on modern distros. It can work if you do not want to write application logic, but expect compatibility work. (linuxtoday.com)

Modern/reliable pattern I recommend: authenticate users in your app, track per-user bytes in a DB or Redis (atomic check-and-increment on each download), and then hand the file to the webserver for efficient delivery using X-Sendfile / X-Accel-Redirect. That gives precise quota control, avoids reimplementing HTTP serving, and scales well. Be careful to handle Range requests, resume, and race conditions with atomic counters. (github.com)

Quick practical tips: decide whether you need hard enforcement (block after limit) or soft (throttle/redirect). For FTP use daily cron to reset tallies; for app-based gates, use atomic DB/Redis ops and test with curl/wget including Range headers. Log and verify counts from the server side before enforcing to avoid accidental lockouts.

You can limit the bandwidth (the speed) but not the actual GBs the user has downloaded. See mod_bandwidth if you want to use this feature.

Otherwise you'll need some programming knowledge to do what you intended to do (to limit the number of bytes sent to a particular user).

define short-circuiting and fall through in C++

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.