Controller subdomains

Hi. i would like to make subdomain controller classes. was wondering
what aspects of rails (and/or server) i would have to configure.

example:

sub_controller1.mydomain.com/controller/action
sub_controller2.mydomain.com/controller/action
etc.

Insights?

Thanks