1 00:00:06,040 --> 00:00:11,460 In this new section of the course we're look at using engine X as a reverse proxy and load balancer 2 00:00:11,460 --> 00:00:13,070 respectively. 3 00:00:13,090 --> 00:00:18,460 Now whilst these two topics are not strictly using engine X as a web server they are nonetheless key 4 00:00:18,490 --> 00:00:22,080 concepts and primary use of engine x. 5 00:00:22,300 --> 00:00:27,250 Before we begin I want to demonstrate how these lessons will vary to what we've been doing up until 6 00:00:27,250 --> 00:00:28,060 now. 7 00:00:28,170 --> 00:00:33,850 For one I'll no longer be using a virtual server but instead demonstrate using the local installer of 8 00:00:33,850 --> 00:00:35,700 engine X on my computer. 9 00:00:35,890 --> 00:00:40,930 Then as will be needing multiple web servers to properly demonstrate load balancing. 10 00:00:41,200 --> 00:00:45,010 I'll be running simple BHB servers from the command line. 11 00:00:45,130 --> 00:00:50,220 You can choose to do the same or alternatively use any Web server of your choosing. 12 00:00:50,230 --> 00:00:55,390 I have linked to a comprehensive list of simple command line Web servers in the resources of this lesson 13 00:00:56,230 --> 00:01:02,770 to run engine X locally albhy creating a basic configuration file in this engine XT directory and start 14 00:01:02,770 --> 00:01:06,160 engine X with that configuration file specified. 15 00:01:06,160 --> 00:01:15,070 So for example create a new config file in this directly touch engine X dot conf and switch to my editor 16 00:01:15,070 --> 00:01:21,310 where we can see that new config file forcer got a logo image here but will use that in a minute. 17 00:01:21,840 --> 00:01:25,100 Create the event block as it's required. 18 00:01:26,500 --> 00:01:30,110 HTP and a server block. 19 00:01:30,190 --> 00:01:36,160 This is just serkin demonstrate starting engine X with a custom configuration lesson on port eight thousand 20 00:01:36,160 --> 00:01:37,730 eight hundred eighty eight. 21 00:01:37,780 --> 00:01:39,410 No need for a server name. 22 00:01:39,430 --> 00:01:47,050 This will just default to local host and a location block that simply returns a success status 200 with 23 00:01:47,050 --> 00:01:50,430 a plain text response of hello from in Genex. 24 00:01:51,500 --> 00:01:56,780 Save that and now to start engine X with this configuration. 25 00:01:56,840 --> 00:02:05,060 We can say engine X so that engine X executable with a C flag for configuration passing the absolute 26 00:02:05,060 --> 00:02:11,660 path to this configuration file we just create it enter and that server should now be running as we're 27 00:02:11,660 --> 00:02:15,290 not seeing any configuration issues being reported. 28 00:02:15,290 --> 00:02:17,580 Test this by curling the server. 29 00:02:17,780 --> 00:02:25,250 Cool HTP local host port eight thousand eight hundred eighty eight as we configured it in the engine 30 00:02:25,250 --> 00:02:29,540 extort confocal enter and we get the response. 31 00:02:29,750 --> 00:02:32,700 So that's running and responding as expect it. 32 00:02:33,060 --> 00:02:39,200 Then as I mentioned to test our engine X server in the reverse proxy and load balancing listens I'll 33 00:02:39,200 --> 00:02:41,900 use a very simple HP server. 34 00:02:41,990 --> 00:02:47,030 This is built into BHB and can again be fired up from the command line without having to create any 35 00:02:47,030 --> 00:02:55,970 real configuration files say be HP with a capital S flag for server and pass the host and port to run 36 00:02:55,970 --> 00:03:01,460 this on localhost again with port nine thousand nine hundred ninety nine. 37 00:03:01,460 --> 00:03:07,410 This time that starts this time being a foreground process unlike the engine X server. 38 00:03:07,630 --> 00:03:12,710 Now page piece built in server default to serving the directory it's run from. 39 00:03:12,740 --> 00:03:18,330 So in my case that engine xto rectory I'll never get that you are on my browser. 40 00:03:18,380 --> 00:03:22,080 9 9 9 9 and we get a four of four. 41 00:03:22,100 --> 00:03:27,290 As I didn't specify a bath or have an index file in that root directory. 42 00:03:27,290 --> 00:03:34,870 If however I never go to that logo image pacifically logo dot PRNG we get the logo. 43 00:03:34,880 --> 00:03:40,520 An alternative to running this pier to be serve in a directory is to simply pass at some file. 44 00:03:40,520 --> 00:03:46,490 The result of that file being returned for our purposes will simply need to identify this as I appear 45 00:03:46,490 --> 00:03:49,700 to be server so I'll create a new text file. 46 00:03:49,940 --> 00:03:50,400 All it. 47 00:03:50,420 --> 00:03:51,330 Response. 48 00:03:51,350 --> 00:03:54,140 T s t r e s p. 49 00:03:54,350 --> 00:03:57,590 And in this one I'll say hello from. 50 00:03:57,590 --> 00:03:57,940 P. 51 00:03:57,980 --> 00:03:58,780 P. 52 00:03:59,650 --> 00:04:06,210 Safe start that server again this time specifying their response to a text file. 53 00:04:07,930 --> 00:04:11,450 Call local host on port 9 9 9 9. 54 00:04:12,230 --> 00:04:17,200 And we see the response confirming that we're hearing from the pitch B server. 55 00:04:17,240 --> 00:04:21,920 That's basically it for this video and I really just wanted to demonstrate how will be running in genetics 56 00:04:21,950 --> 00:04:27,380 and testing it without creating several virtual machines in the next place and will move on to cover. 57 00:04:27,380 --> 00:04:29,380 Engine X as a reverse proxy.