This sounds a little like my setup I have in place on my network. I have multiple web facing services on my home servers but on different system IPs.
I have a dedicated nginx server on one system that handles all the inbound traffic on the public IP over ports 80 and 443, and reverse-proxies to the backend servers on my network where things are (which are Apache, nginx, and lighttpd, so it's not necessarily specific for the backends). I currently do this for a GitLab instance and an OwnCloud instance on separate IP addresses, and a server that's currently off (previously ran a test instance of MediaWiki).
NOTE: This answer is written with the idea that the system doing the reverse-proxying defined below is a separate system, and not one of your existing server configurations. If it's one of your existing servers, then do not change the existing configurations, except to add a new one for the individual site that is not on that server, rather than setting up new configurations for each server. I also suggest the use of nginx; you can do this on whatever web server you want, I just know how to rapidly do this in nginx.
(1) Install nginx on one of the servers, or set up another one
I use nginx, and the nginx-core variant for this, but you can use Apache or any web server you're comfortable with and know how to configure (but since I use nginx, I'm using nginx instructions here). I also use ssl-cert to create a junk self-signed cert for the default catch all to use.
sudo apt-get install nginx nginx-core ssl-cert
(2) Configure that nginx server for a 'default' catch-all for invalid domains.
First, let's do some changes for the default catch-all site.
sudo rm /etc/nginx/sites-enabled/default
sudo touch /etc/nginx/sites-available/catch-all
Put this into the /etc/nginx/sites-available/catch-all file:
server {
listen 80 default_server;
listen 443 ssl default_server;
server_name _;
include snippets/snakeoil.conf;
return 404;
}
This is a default 'catch all' for any type of connection to the IP address for any domain we haven't configured on the nginx instance to listen for the connections. This way, we can serve a "Not Found" for any invalid domains being directed here. We will explicitly define all domains we say are OK in individual configuration files. For now, though, let's enable this catch all, then start setting up individual domains.
sudo ln -s /etc/nginx/sites-available/catch-all /etc/nginx/sites-enabled/
(3) Configure nginx for individual permitted sites and their reverse proxies
For this example, I am going to use www.foo.co.uk and www.bar.co.uk per your post.
Basically, I'm going to give you an example file that you can use for the reverse proxy configuration. This should work with most reverse proxy setups, though the individual sites you're running may have slight nuances that I can't help with here.
For each site you want to reverse proxy, start by creating the file with the domain name. I'm going to use the two domains you stated as examples.
sudo touch /etc/nginx/sites-available/{www.foo.co.uk,www.bar.co.uk}
In each of the two created files, you can put this in place. Just update the information accordingly wherever my comments are (they're preceded by #):
server {
listen 80;
server_name DOMAINNAME; # Replace DOMAINNAME with the actual domain
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
# Replace this INTERNALIPADDRESS:PORT with the IP and port
# combination for the server on your network handling the
# above-specified domain name.
proxy_pass http://INTERNALIPADDRESS:PORT/;
}
}
Once created, we once again need to activate them.
sudo ln -s /etc/nginx/sites-available/www.foo.co.uk /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/www.bar.co.uk /etc/nginx/sites-enabled/
Now that we've activated the sites, let's make sure there's no configuration errors here. If this command spits out anything other than 'the configuration file syntax is ok' and 'configuration file test is successful', then you need to address those errors:
sudo nginx -t
If there's no error notices and you get the "OK" and "Successful" messages, then restart the nginx process to make all the configurations actually take effect.
Ubuntu 14.04 and earlier:
sudo service nginx restart
Ubuntu 16.04:
sudo systemctl restart nginx
(4) Configure port forwarding on your network to forward ports 80 and 443 to the server you just set up this reverse-proxy server on.
In the example I just wrote, let's say that the server I put nginx on is 192.168.100.200. On your router, set up port 80 and port 443 to route to that IP address. If you don't intend on using HTTPS, then only forward port 80.
(5) Point the DNS for your domains to your public IP address at your home.
This is pretty self explanatory, but make sure the DNS A record points to the IP address that your router gives you on the Public Internet. (Go to ipchicken.com or similar to get your IP address if you don't know it)
(6) You're done, as soon as the DNS propagates. Test from any system NOT on your home network (such as a computer on a public wifi at a coffee shop or something).