How can I set up a domain or subdomain to point to my web server listening on a different (non-standard) port?
I'm running a node.js app my server which is using port 80. But now I need to run a standard http web server, so I need to use a different port (8080). How can I point my domain or subdomain to my server using a different port?
The DNS system doesn't explicitly allow you to specify a port number when you create A/AAAA records. Though, in limited cases, an SRV record can be used to direct traffic to a specific port number (What is an SRV record?). However, this isn't something that is supported by browsers (most just look for port 80/443 connections by default and don't request SRV records).
One work around would be to put a reverse proxy (like Nginx) in front of both of your applications. Any requests for your domain and/or subdomain would first reach Nginx, and then Nginx would pass the connection to a different server (like the node.js server or Apache running WordPress).
In your situation, you could have your node.js app listen on 8000 (for example.com), then have another website running WordPress on Apache listening on 8080 (for subdomain.example.com). Nginx would be configured to pass traffic off to either service.