Theodoros' answer is right, but it can be completed a bit.
What you need is to instruct eZ Publish to map each domain name to a specific siteaccess (front/backoffice). You can read more about it in the HostMatchType documentation on ez.no: http://ez.no/doc/ez_publish/technical_manual/4_x/reference/configuration_files/site_ini/siteaccesssettings/hostmatchtype. The example you're looking for is "Map matching".