3

Basically I run a VPS and host my clients' sites on it. I have mod_vhost_alias set up to use the domain as the client's user account home folder, eg /home/www.example.com. I'd like to use mod_cband to limit the bandwidth per domain too. I know I can do this per virtualhost, but I have it set up using mod_vhost_alias. Is this possible?

For your reference, this is what I have so far...

<VirtualHost *:80>
    # Doesn't matter as long as it's fake rlly
    ServerName bogusname
    UseCanonicalName Off
    VirtualDocumentRoot /home/%0/www

    # Bandwidth stuff
    CBandDefaultExceededURL http://clients.bradreed.co.uk/bandwidth_exceeded.html
    CBandLimit 100G
    # The following doesn't work
    CBandScoreboard /var/www/scoreboard/%0
</VirtualHost>

Thank you :)

Brad Reed
  • 143
  • 5

1 Answers1

1

The short answer is NO. As you have discovered the %0 expansion is specific to the mod_vhost_alias directives and not supported in other modules.

The main problem is that Apache's design is based on a static configuration, where mod_vhost_alias is simply put an exception, a hack. That makes it dynamic configuration of other modules and directive difficult.

If you want to use mod_cband, AFAIK you must start working with client specific virtual host entries and restart your webserver whenever a new client is on-boarded.

I imagine most providers with a mod_vhost_alias setup would parse the apache log files and use the resulting statistics as a bandwidth accounting tool.

HBruijn
  • 77,029
  • 24
  • 135
  • 201