1
00:00:00,000 --> 00:00:17,760
Hey everyone and welcome back. Now in the previous nugget we had talked about a forward

2
00:00:17,760 --> 00:00:23,920
proxy. Now what I want to do is to talk to you about a reverse proxy. So really when

3
00:00:23,920 --> 00:00:29,719
we're talking about a reverse proxy versus a forward proxy we're ultimately talking

4
00:00:29,719 --> 00:00:35,200
about which end of the transaction is using the proxy. Now that might sound a little bit

5
00:00:35,200 --> 00:00:40,560
strange but just think about what we talked about. We had our server here in the original

6
00:00:40,560 --> 00:00:47,599
example. You know we had our client here and we had our forward proxy. Now ultimately as

7
00:00:47,599 --> 00:00:54,519
it transpires in this transaction both the client and the server are talking to the proxy

8
00:00:54,520 --> 00:00:59,480
because the client makes a request to the proxy and the proxy makes a request on the

9
00:00:59,480 --> 00:01:04,359
client's behalf and then the server talks back to the proxy with the response and the

10
00:01:04,359 --> 00:01:09,840
proxy passes that back. Now in the case of a reverse proxy the same type of thing is

11
00:01:09,840 --> 00:01:16,159
happening i.e. the client and the server are both still talking to the proxy but it really

12
00:01:16,159 --> 00:01:22,760
is all about who is configured to use the proxy directly. So what do I mean here? Well

13
00:01:22,800 --> 00:01:29,040
in this transaction here of the forward proxy it is the client that actually has the proxy

14
00:01:29,040 --> 00:01:35,200
setting so it is the one who is really forced into using the proxy. The server's participation

15
00:01:35,200 --> 00:01:40,560
in this transaction is kind of incidental it's because the client was configured to

16
00:01:40,560 --> 00:01:45,840
use the proxy and the proxy has given the server a request. Now with respect to a reverse

17
00:01:45,840 --> 00:01:51,280
proxy things are a little bit different. Again we have our proxy in the middle here but this

18
00:01:51,320 --> 00:01:57,079
time it's actually the server's configuration that is directly pointing to the proxy. So what

19
00:01:57,079 --> 00:02:02,920
this means is that when a client wants to make a request to a particular server it's got to

20
00:02:02,920 --> 00:02:07,960
make this request via the proxy itself. So this is why this can be a little bit confusing it

21
00:02:07,960 --> 00:02:13,280
almost looks like the same thing a client and a server are ultimately talking to each other

22
00:02:13,280 --> 00:02:18,039
and they're talking to each other via this middleman the proxy but like I say here in the

23
00:02:18,079 --> 00:02:23,199
case of a reverse proxy it's actually the server who has all the configuration files which are

24
00:02:23,199 --> 00:02:28,560
pointing to the proxy and with respect to a forward proxy the opposite is true it is the

25
00:02:28,560 --> 00:02:33,120
client which has all the configuration files which are pointing to the proxy to initiate the

26
00:02:33,120 --> 00:02:39,280
transaction. Now with respect to a reverse proxy this is very useful for things such as load

27
00:02:39,280 --> 00:02:45,759
balancing which ultimately promotes efficiency and performance. So really a reverse proxy is

28
00:02:45,799 --> 00:02:52,199
really very useful when you happen to have a popular and very frequently accessed service

29
00:02:52,199 --> 00:02:57,919
because if you just happen to have one server here and you had a whole bunch of people out on

30
00:02:57,919 --> 00:03:03,359
the internet whatever it may be all making lots and lots of requests to your server let's maybe

31
00:03:03,359 --> 00:03:09,280
say this server belonged to Amazon so lots of requests going into this server this one server

32
00:03:09,280 --> 00:03:15,439
could quite easily understandably get bogged down and ultimately you'd have a denial of service.

33
00:03:15,639 --> 00:03:22,000
So instead what you can do is you can present a proxy server to all of these end users so they

34
00:03:22,000 --> 00:03:28,039
make a simple request and they just talk to the proxy server and behind the proxy server you

35
00:03:28,039 --> 00:03:34,240
could have a cluster of these servers who are all configured to use this reverse proxy. So that

36
00:03:34,240 --> 00:03:39,759
means once the request comes in the proxy just relays that to another server within the cluster

37
00:03:39,959 --> 00:03:45,639
and that means we're now actually spreading out these transactions over different servers all

38
00:03:45,639 --> 00:03:51,239
hidden behind the same proxy server so no one is getting overloaded the load is instead being

39
00:03:51,239 --> 00:03:57,280
balanced across different servers and of course the actual backend servers here are not directly

40
00:03:57,280 --> 00:04:04,479
exposed to the outside internet say for example instead we're only exposing the proxy to the

41
00:04:04,479 --> 00:04:10,399
public or to another network and another big thing with respect to reverse proxy servers is

42
00:04:10,399 --> 00:04:16,800
caching if one user here happens to make a request from a particular server let's say this one here

43
00:04:16,800 --> 00:04:22,399
let's maybe say it's some type of graphical image that graphical image could be stored locally as

44
00:04:22,399 --> 00:04:28,560
cash on the proxy server so that when another user makes the same request the information is

45
00:04:28,639 --> 00:04:35,439
cached and quickly accessible and can be returned back to this user without having to bog down any

46
00:04:35,439 --> 00:04:39,439
of these backend servers making the same request again so this is really going to lessen the

47
00:04:39,439 --> 00:04:44,720
burden on these backend servers as well as improved performance from the perspective of the client

48
00:04:44,720 --> 00:04:50,480
who's going to receive that information really really quickly now with respect to reverse proxies one

49
00:04:50,480 --> 00:04:55,759
solution we want to be looking at is something called engine x now engine x is really really

50
00:04:55,759 --> 00:05:02,399
similar to Apache remember this was our web server we looked at recently but engine x is kind of seen

51
00:05:02,399 --> 00:05:07,599
as a more modern implementation of Apache it's a little bit more focused it's a little bit more

52
00:05:07,599 --> 00:05:13,599
lightweight now the details of comparing engine x and Apache is not actually within the objectives

53
00:05:13,599 --> 00:05:19,120
of the lpik 2 examination but understand that engine x happens to be a very popular solution

54
00:05:19,120 --> 00:05:24,480
to be configured as a web server and as a reverse proxy so let me quickly walk you through how we

55
00:05:24,480 --> 00:05:30,720
can actually install engine x and point out some of the basic configurations so what we'll do here

56
00:05:30,720 --> 00:05:37,840
is i'll just first uninstall my Apache 2 service for now so cd back and i'll just say sudo apt

57
00:05:37,840 --> 00:05:45,439
remove apache 2 and i'll type in my password okay so now i no longer have any web servers on my

58
00:05:45,439 --> 00:05:52,080
ubuntu machine i'm now going to install engine x i'll say engine x hit enter and i'll say yes now

59
00:05:52,079 --> 00:05:56,800
with engine x installed we're going to see that we have a main configuration file so now what i want

60
00:05:56,800 --> 00:06:01,599
to do is to open up my engine x configuration file this is any particular location that you do want

61
00:06:01,599 --> 00:06:08,560
to be remembering it's in the etsy directory within our newly created engine x directory and the file

62
00:06:08,560 --> 00:06:14,639
itself is called engine x dot conv if i open this up we're going to see here this is the main

63
00:06:14,639 --> 00:06:21,279
configuration file now one thing you will notice with respect to engine x is that we have a lot of

64
00:06:21,279 --> 00:06:26,239
crossover with what we saw with apache so let me just briefly show you what that is say for example

65
00:06:26,239 --> 00:06:33,599
if i go into etsy engine x and i do an ls you'll notice things such as sites available and sites

66
00:06:33,599 --> 00:06:37,919
enabled similarly to what we saw with apache if we go into sites enabled we're going to see a bunch

67
00:06:37,919 --> 00:06:44,479
of sim links which ultimately point to the sites available directory same as true with respect to

68
00:06:44,479 --> 00:06:49,919
the modules enabled directory which points to configurations within modules available we have

69
00:06:49,920 --> 00:06:55,280
a lot of crossover here with respect to these two solutions so what you learned in apache a lot of

70
00:06:55,280 --> 00:07:00,640
it is going to be irrelevant and applicable here now one thing to note is that just like with apache

71
00:07:00,640 --> 00:07:09,200
too we can also look in our var directory or ww directory as well as html and if i do an ls we

72
00:07:09,200 --> 00:07:15,520
can actually see here i do have an engine x file this is like my index dot html in fact let me just

73
00:07:15,599 --> 00:07:22,639
remove my index dot php that was what i had for my apache server and i'll just move this one and

74
00:07:22,639 --> 00:07:30,159
just call this index dot html is so you'll notice here we have a bunch of html this has got some

75
00:07:30,159 --> 00:07:36,319
default formatting relating to engine x nothing special here again it's just plain html but notice

76
00:07:36,319 --> 00:07:44,479
now with this actually installed if i say sudo system ctl start engine x and i say sudo system ctl

77
00:07:45,040 --> 00:07:50,319
status engine x we can see the web server engine x is running what i can do is i can go to my web

78
00:07:50,319 --> 00:07:58,480
browser so i'll type in my local ip address of 192.1680.44 and we are now accessing our default

79
00:07:58,480 --> 00:08:04,240
engine x html page now one thing you might actually notice is that depending on your system as opposed

80
00:08:04,240 --> 00:08:10,560
to looking in this directory here for this particular file instead your engine x server

81
00:08:10,560 --> 00:08:17,759
may actually be configured by default to point to this location here which would be the user share

82
00:08:17,759 --> 00:08:25,040
engine x and in here you may have an index dot html file within here so just understand that depending

83
00:08:25,040 --> 00:08:29,920
on the installation there might be a little bit of variation there but now like i say engine x can

84
00:08:29,920 --> 00:08:35,840
be a web server as we see here but we can also configure it to act as a reverse proxy now the

85
00:08:35,840 --> 00:08:41,360
configuration for the reverse proxy is actually very very simple and that is the good news so what

86
00:08:41,360 --> 00:08:46,000
i'm going to do here is i'm going to try to clear my screen and i'm going to go into that

87
00:08:46,000 --> 00:08:52,480
configuration file i talked about earlier so that's etsy engine x and i'll go into engine x.conf in fact

88
00:08:52,480 --> 00:08:59,280
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

89
00:08:59,280 --> 00:09:04,879
is if i scroll on down i'm just going to add some new configurations so i'll just use my

90
00:09:04,879 --> 00:09:10,799
hashtag to just maybe give a description just say my reverse proxy settings again this is just a

91
00:09:10,799 --> 00:09:17,759
comment nothing special here and i will go in and i will use the keyword server and then a curly brace

92
00:09:17,759 --> 00:09:24,720
and then within the curly braces i'm going to say lesson on port 80 and then i will have my semi colon

93
00:09:24,720 --> 00:09:28,879
so then i'm going to see a location and then i'll say forward slash the point to the root

94
00:09:28,879 --> 00:09:34,639
directory and then i'll open my curly braces and then i'm going to use this very particular keyword

95
00:09:34,720 --> 00:09:41,439
proxy underscore pass this is something you want to be remembering and all i'm going to do here

96
00:09:41,439 --> 00:09:47,600
is to specify the location of the remote ip where i'm actually going to be acting as a proxy for

97
00:09:47,600 --> 00:09:53,120
so i could just say http and then whatever the ip address may be of who i'm actually proxying with

98
00:09:53,120 --> 00:10:02,080
let's just maybe say 192 168 0.100 or this could be a domain name such as ipv0 blah blah

99
00:10:02,160 --> 00:10:06,480
dot com whatever it may be whatever the server happens to be so i'll just add in some

100
00:10:06,480 --> 00:10:13,520
address of some non-existent server let's just say 192 168 0.133 and then i want to close my

101
00:10:13,520 --> 00:10:21,040
curly brace and then again one final curly brace oh and i've just noticed something very very important

102
00:10:21,040 --> 00:10:27,280
after you specify your proxy pass server you absolutely want to be ending that statement

103
00:10:27,279 --> 00:10:32,799
with the semicolon once again and really that is all there is to it it's just this small little

104
00:10:32,799 --> 00:10:38,639
section here that you see right here that can allow us to set a reverse proxy configuration now of

105
00:10:38,639 --> 00:10:44,000
course there are way way way more things that we can modify and configure and do with our engine x

106
00:10:44,000 --> 00:10:50,240
server but for the purposes of the objectives within the lp2 examination a very simple configuration

107
00:10:50,240 --> 00:10:55,919
as we see here is all we have to understand and recognize for the purposes of the examination

108
00:10:55,919 --> 00:11:01,759
ok doc so that is us for our introduction into reverse proxies and engine x i hope this has

109
00:11:01,759 --> 00:11:11,839
been informative for you and i'd like to thank you for viewing

