Hey everyone and welcome back. Now in the previous nugget we had talked about a forward
proxy. Now what I want to do is to talk to you about a reverse proxy. So really when
we're talking about a reverse proxy versus a forward proxy we're ultimately talking
about which end of the transaction is using the proxy. Now that might sound a little bit
strange but just think about what we talked about. We had our server here in the original
example. You know we had our client here and we had our forward proxy. Now ultimately as
it transpires in this transaction both the client and the server are talking to the proxy
because the client makes a request to the proxy and the proxy makes a request on the
client's behalf and then the server talks back to the proxy with the response and the
proxy passes that back. Now in the case of a reverse proxy the same type of thing is
happening i.e. the client and the server are both still talking to the proxy but it really
is all about who is configured to use the proxy directly. So what do I mean here? Well
in this transaction here of the forward proxy it is the client that actually has the proxy
setting so it is the one who is really forced into using the proxy. The server's participation
in this transaction is kind of incidental it's because the client was configured to
use the proxy and the proxy has given the server a request. Now with respect to a reverse
proxy things are a little bit different. Again we have our proxy in the middle here but this
time it's actually the server's configuration that is directly pointing to the proxy. So what
this means is that when a client wants to make a request to a particular server it's got to
make this request via the proxy itself. So this is why this can be a little bit confusing it
almost looks like the same thing a client and a server are ultimately talking to each other
and they're talking to each other via this middleman the proxy but like I say here in the
case of a reverse proxy it's actually the server who has all the configuration files which are
pointing to the proxy and with respect to a forward proxy the opposite is true it is the
client which has all the configuration files which are pointing to the proxy to initiate the
transaction. Now with respect to a reverse proxy this is very useful for things such as load
balancing which ultimately promotes efficiency and performance. So really a reverse proxy is
really very useful when you happen to have a popular and very frequently accessed service
because if you just happen to have one server here and you had a whole bunch of people out on
the internet whatever it may be all making lots and lots of requests to your server let's maybe
say this server belonged to Amazon so lots of requests going into this server this one server
could quite easily understandably get bogged down and ultimately you'd have a denial of service.
So instead what you can do is you can present a proxy server to all of these end users so they
make a simple request and they just talk to the proxy server and behind the proxy server you
could have a cluster of these servers who are all configured to use this reverse proxy. So that
means once the request comes in the proxy just relays that to another server within the cluster
and that means we're now actually spreading out these transactions over different servers all
hidden behind the same proxy server so no one is getting overloaded the load is instead being
balanced across different servers and of course the actual backend servers here are not directly
exposed to the outside internet say for example instead we're only exposing the proxy to the
public or to another network and another big thing with respect to reverse proxy servers is
caching if one user here happens to make a request from a particular server let's say this one here
let's maybe say it's some type of graphical image that graphical image could be stored locally as
cash on the proxy server so that when another user makes the same request the information is
cached and quickly accessible and can be returned back to this user without having to bog down any
of these backend servers making the same request again so this is really going to lessen the
burden on these backend servers as well as improved performance from the perspective of the client
who's going to receive that information really really quickly now with respect to reverse proxies one
solution we want to be looking at is something called engine x now engine x is really really
similar to Apache remember this was our web server we looked at recently but engine x is kind of seen
as a more modern implementation of Apache it's a little bit more focused it's a little bit more
lightweight now the details of comparing engine x and Apache is not actually within the objectives
of the lpik 2 examination but understand that engine x happens to be a very popular solution
to be configured as a web server and as a reverse proxy so let me quickly walk you through how we
can actually install engine x and point out some of the basic configurations so what we'll do here
is i'll just first uninstall my Apache 2 service for now so cd back and i'll just say sudo apt
remove apache 2 and i'll type in my password okay so now i no longer have any web servers on my
ubuntu machine i'm now going to install engine x i'll say engine x hit enter and i'll say yes now
with engine x installed we're going to see that we have a main configuration file so now what i want
to do is to open up my engine x configuration file this is any particular location that you do want
to be remembering it's in the etsy directory within our newly created engine x directory and the file
itself is called engine x dot conv if i open this up we're going to see here this is the main
configuration file now one thing you will notice with respect to engine x is that we have a lot of
crossover with what we saw with apache so let me just briefly show you what that is say for example
if i go into etsy engine x and i do an ls you'll notice things such as sites available and sites
enabled similarly to what we saw with apache if we go into sites enabled we're going to see a bunch
of sim links which ultimately point to the sites available directory same as true with respect to
the modules enabled directory which points to configurations within modules available we have
a lot of crossover here with respect to these two solutions so what you learned in apache a lot of
it is going to be irrelevant and applicable here now one thing to note is that just like with apache
too we can also look in our var directory or ww directory as well as html and if i do an ls we
can actually see here i do have an engine x file this is like my index dot html in fact let me just
remove my index dot php that was what i had for my apache server and i'll just move this one and
just call this index dot html is so you'll notice here we have a bunch of html this has got some
default formatting relating to engine x nothing special here again it's just plain html but notice
now with this actually installed if i say sudo system ctl start engine x and i say sudo system ctl
status engine x we can see the web server engine x is running what i can do is i can go to my web
browser so i'll type in my local ip address of 192.1680.44 and we are now accessing our default
engine x html page now one thing you might actually notice is that depending on your system as opposed
to looking in this directory here for this particular file instead your engine x server
may actually be configured by default to point to this location here which would be the user share
engine x and in here you may have an index dot html file within here so just understand that depending
on the installation there might be a little bit of variation there but now like i say engine x can
be a web server as we see here but we can also configure it to act as a reverse proxy now the
configuration for the reverse proxy is actually very very simple and that is the good news so what
i'm going to do here is i'm going to try to clear my screen and i'm going to go into that
configuration file i talked about earlier so that's etsy engine x and i'll go into engine x.conf in fact
i need to go in and use an editor there we go engine x.conf hit enter and what i'm going to do here
is if i scroll on down i'm just going to add some new configurations so i'll just use my
hashtag to just maybe give a description just say my reverse proxy settings again this is just a
comment nothing special here and i will go in and i will use the keyword server and then a curly brace
and then within the curly braces i'm going to say lesson on port 80 and then i will have my semi colon
so then i'm going to see a location and then i'll say forward slash the point to the root
directory and then i'll open my curly braces and then i'm going to use this very particular keyword
proxy underscore pass this is something you want to be remembering and all i'm going to do here
is to specify the location of the remote ip where i'm actually going to be acting as a proxy for
so i could just say http and then whatever the ip address may be of who i'm actually proxying with
let's just maybe say 192 168 0.100 or this could be a domain name such as ipv0 blah blah
dot com whatever it may be whatever the server happens to be so i'll just add in some
address of some non-existent server let's just say 192 168 0.133 and then i want to close my
curly brace and then again one final curly brace oh and i've just noticed something very very important
after you specify your proxy pass server you absolutely want to be ending that statement
with the semicolon once again and really that is all there is to it it's just this small little
section here that you see right here that can allow us to set a reverse proxy configuration now of
course there are way way way more things that we can modify and configure and do with our engine x
server but for the purposes of the objectives within the lp2 examination a very simple configuration
as we see here is all we have to understand and recognize for the purposes of the examination
ok doc so that is us for our introduction into reverse proxies and engine x i hope this has
been informative for you and i'd like to thank you for viewing