Using a specific port with DNS A Records
Configuring DNS on a domain is pretty straight forward, we can leverage the A record. What happens when we want to point to a specific port that we are forwarding to? To do so, we need to edit the apache2 settings to recognize to incoming domain name and make it access the proper port. You can do so by editing the apache2 000-default.conf file and adding in a virtual host entry.
<VirtualHost *:80> ProxyPreserveHost On ProxyPass / http://0.0.0.0:1234/ ProxyPassReverse / http://0.0.0.0:1234/ ServerName hemstreet.io </VirtualHost>
Now that we have an entry in our virtual host. We need to restart the apache2 server `sudo service nginx restart`.
After the apache server restarts we can load up our domain. In this case it’s hemstreet.io and we can see that it is no longer pointed to the default port, instead it load the port we specified!