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.

`nano /etc/apache2/sites-available/000-default.conf`

<VirtualHost *:80>

    ProxyPreserveHost On

    ProxyPass /

    ProxyPassReverse /



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 and we can see that it is no longer pointed to the default port, instead it load the port we specified!


Innovative, entrepreneurial and positively unsatisfied mind that constantly pushes the tech boundaries to create new solutions and devices that change people’s lives. Throughout my career, I have had the opportunity of having a multi-disciplinary experience, which led me to wear the hats of: Architect, IoT Consultant (Internet of Things Consultant), Developer, Designer, Engineer, Server Admin, Consultant and Project Manager – to name a few. Based on this diversified background, I get projects done by following smart ideas and well-planned goals. In a world which is getting more unconventional by the day, I use unconventional ways, and a very healthy dose of integrity, to create devices and solutions that help companies go from a steady present to a dynamic future.

You may also like...