What is the best way to make a sub-domain on Ubuntu 16.04 server version

Hello everyone.
does anyone know the best and easiest way to add a sub-domain to the apache2 configuration in Ubuntu 16.04 server?

I know how to do it but in a way that doesn’t make sense to me and it is really complicated.

and one more question that I have is how to make that sub-domain accessible only on the local network of the server like OpenVPN or ssh localhost redirection

If it’s something just for the local network, then don’t do a subdomain at all. Otherwise it will be public.

1 Like

https://help.ubuntu.com/16.04/serverguide/firewall.html
doing it in the firewall is the best.