We've got a blank file here and we need to create the virtual host, so I'm going to
explain what I'm doing as I'm doing it. So, we're going to open up the element
VirtualHost and its capital case. We're going to specify the port that it's listening on,
which by default for Apache is port 80, that's the default port for web traffic,
that's what you should be using, and then we close off that element. Now the first thing
we're gonna do is assign a server name and this basically tells the VirtualHost
what name it should be listening to So, it's listening on port 80, now
we're gonna tell it that this configuration is for the domain "app.localhost" and then type
"ProxyRequests Off" jump down a few lines we're going to to configure the proxy. So, it's
kind of like HTML, your opening elements, and typing things, and we're gonna type
"Order deny,allow" no space between deny,allow and then "Allow from all".
We need to actually configure the proxy and tell it what it's listening for on
which ports, and what not. So, to do this open up a location element, and location is going to be
"<Location />" this means it's the root of this domain, so we should be able to
access app.localhost and it should work great.
So, we need two lines in here,
the first is gonna be "ProxyPass" then what its passing it to, which is going to be
"http://localhost:port58080/ and then "ProxyPassReverse http://localhost:pot58080"
Hit save, we're done with this, Apache is all configured to translate local host at port
58080 to the URL at localhost. So, save it, exit. So, now that we've got the virtualhost configured, we can actually
add this site or enable it, and to do that you just type "sudo a2ensite" and the site
and then the name of the site. In this case it's app because it's everything that's
prefixed from the extensions, so everything before the ".com" So, I'm gonna
type "app". So, now that we've got all the modules enabled, the virtual host
configured and enabled, now we can restart the Apache 2 service. So, "sudo systemctrl
restart apache2"