Both nginx and apache are webservers and can do what you need.
Apache calls this Name-based Virtual Hosts. (see ServerName/ServerAlias)
Nginx calls this Name-based virtual servers (see server_name in the docs)
Either will listen on ports 80/443 on the IP and proxy the request depending on the hostname used. If you’re not really familiar with either, I would recommend nginx. It’s very popular, the documentation is good and the syntax is a lot better IMO.
I hear caddy is also a nice alternative with even simpler syntax, but I haven’t used it myself.
Good luck!
Read a publisher called Wired
Look inside
No wires…