a short example. let say you have example.com
domain served by apache on port 80. probably you also have a bind server so you can add in the db.example.com
file a CNAME (or A) record like
goapp IN CNAME example.com.
so, your apache will serve now goapp.example.com
an also example.com
both on port 80. next, make a virtual host in /etc/apache/sites-available
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName goapp.example.com
Redirect "/" "http://goapp.example.com:8081"
</VirtualHost>
enable, this in with a symbolic link in /etc/apache/sites-enabled
, compile with run your go application on port 8081. you can run your go application with no root rights.
now, if you will access goapp.example.com
you will be redirect to goapp.example.com:8081