Configuring Nginx as a reverse proxy for Apache

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] this lesson will configure engines and Apache web servers to work together this tandem distributes resources between two servers one engines works as a front-end and is responsible for serving the static content to visitors such as images pure HTML Java screen and other types of static files and everything else on the other hand Apache works as a back-end and is responsible for generating dynamic content to reduce the aural load on the server Apache does not work directly with clients all their requests are proxy to engines that returns content to users that way engines keep Apache from consuming additional server sources as Apache in that case doesn't create any child processes that consume huge amounts of RAM usually okay so let's go on and configure these tandem to work together okay let's assume that we start our configuration procedures with the clean system so we have only the operating system installed fresh and clean first of all let's add the apple repository to our system just as with these when we installed the engine server in previous lessons after that run yum update and we update all the packages that are available for our system the whole process takes about two three or five minutes depends on your system and I will cut it out for you after that we'll go on and install the attached e the morality server and PHP and also I want to add some additional packages which is page accelerator and MC and Nana you okay then we start you and now let's quickly test the Apache installation by just visiting the public IP address of our server we should see these test page and it's ok great now let's edit the Apache configuration file with Nano as long as a1 Apache to be the backend server we wanted to listen to the local IP address on the port which is different from port 80 that refers to HTTP traffic usually so let's change this line to local IP address 127 dot 0 dot 0 dot one and the port to 8080 ok and for now we can save the file and exit it now let's go on and install engines we run yum install engines I used to run install engine stable but it doesn't work in the Sun of centralized systems so let's run yum install engines okay after engines is installed let's start it and as you can see we had an error starting engine that is because I've changed the configuration file for Apache but I didn't restart the Apache itself so it's now working on port 80 and when we start engines it also starts it also tries to start itself listening port 80 so let's restart Apache now it should be listening on port 8080 and let's start engine and it starts fine okay now let's go on open nano and edit the engines configuration file what you wanna change here is first of all we change the user to Apache just to make our configuration procedures a lot shorter the Apache works under the Apache user and user group and - we will make the engines also work under this user that usually it works fine and saves you some time so worker processes you can state here the number you like depending on the resources of your server we will stick with outer ok let's change the route website folder to d1 that Apache uses it will serve our needs just fine root VAR 3-w HTML just fine okay so then we our engine server to listen to what 80 right listen 80 default and let's comment this line out then we go to yes let's take this route line and we will move it to another location let's edit the location section of the configuration file will move the route line here and we also want to add some configuration for proxying our prop rocks in the dynamic content - attaching you can just take these lines from the damming configuration file that is included in the additional materials of this lecture and also all the configuration and commands that we run here and that we added in this lesson will be available in the archive that will be added to these lessons as additional materials so just go on and download them ok so at this proxy line great 100 next is we want to go to consider D sub directory in engine directory and we want to create file proxy conf you in this file we based some additional directives for engines that state all the necessary settings for proxying the content to Apache so you just go on paste it and save this file and exit it okay so the next step is we want to create the test website content to test our servers so first of all let's click create the dummy HTML file you now this is a test page okay we save it and exit and oh my goddess every Thunder dot php' let's rename it to index.html you fine and the next one will be the dynamic PHP file or dynamic HP file let's adhere the PHP info function as always you we save it and exit also wanna change the access mode for the PHP file for each to become executable and now let's restart both the Apache and the engines you fine okay so our configuration is now ready let's go and test it first of all let's go to the public IP address you can see the index.html file content and how can we tell that it is served by engine and not Apache you can use any service you like for example this one you place your server's IP address or URL and you have the server mentioned here in Tanjung so the static content insert is served by engines at the moment so now let's go on and run the index dot PHP file and you can see the server process that is being served by Apache 2.0 so our configuration is working fine surely you want to go on and read carefully the documentation if you want to use these setup for production and maybe to use some of the settings that they will be suitable for your needs but in this lesson I just wanted to show you how to set up the basic configuration for engines as a web server and your first proxy for Apache on Santa's operating system so that you can take this how to take this tutorial briss on documentation and make your production server work as you want into that [Music] you
Info
Channel: Alex Grebeshkov
Views: 33,608
Rating: undefined out of 5
Keywords: apache, apache2, nginx, webserver, udemy, grebeshkov, CentOS, RHEL
Id: qPiQXG4JrHc
Channel Id: undefined
Length: 11min 5sec (665 seconds)
Published: Wed Feb 15 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.