I am running two http/2 servers on my ubuntu server. Both should be reachable over port 443.
App A:
Runs on port 8443 and should get requests for domain.com
App B:
Runs on port 8444 and should get requests for subdomain.domain.com
Is there a simple way to do this on Ubuntu?
Yes this is possible.
You need to run a webserver or loadbalancer listening to port 443 and forwarding requests appropriately.
In Apache for example this would be handled as follows:
Now while Apache does support HTTP/2 in both the front end client connections and the back end ProxyPass requests (with mod_proxy_http2), some other webservers/loadbalancers don't (e.g. Nginx). To be honest most of the benefits for HTTP/2 are in the client to edge. So if you prefer to use Nginx for example, you could just have Nginx support HTTP/2, and the connection from Nginx to your back end apps be plain old HTTP/1.1. At least until HTTP/2 becomes more regularly supported. See here for more discussion on this: HTTP2 with node.js behind nginx proxy