What is Nginx | easy way

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there everyone atesh here back again with another video and in this video we're going to talk about what is nginx and in case if you want to know what is nginx the first thing that you have to do is understand what is the problem that nginx is trying to solve once you understand this problem rest of the things are gonna make absolute sense and it's much more easier that way so let me first walk you through what is the problem that nginx is trying to solve nginx is actually a very smart software and is solving a very smart problem and let me tell you this in advance there are not many software which is solving exactly this this problem we have a couple of them but not much so let me walk you through with a scenario which you might be in so let's just say you have worked on an application and you have worked on it on a local machine and whenever you run this application it runs on a specific port just like you always do in the development environment but now it's time that you want to put this application on some big gigantic servers probably aws digitalocean heroku there are plethora of them so in that system you have spin off a machine probably an ubuntu centos whatever is your favorite and you have installed database on it you have installed and deployed your application it is running just like it runs in your local machine and now what is the next thing you obviously spin off your machine probably npm start or a django run or whatever you are deploying and however you are deploying it so in that you just say that my application is running on this port let's just say 4 000 and you're very excited you ask that hey users please go ahead and enjoy my application i have worked so much hard for it and next thing that you know that people are actually enjoying your application they are seeing it using it every single day and then eventually you realized that there is too much traffic on this port here now the next obvious step is to run either another instance of this application since they are connected with the same database it shouldn't be a big issue but you want somehow that the load should be managed so obviously the next step is that you have run another instance of this application and this is now running output 3000 and you shoot up an email to all of your users that hey we are managing some of the load thank you so much for so much of the traffic and now our application is also available on port 3000 it sounds great to you but not to the users because now user have to see that if there is too much load on port 4000 i have to run this application on another port which sounds great to you but not to the user eventually after a few months the traffic is going to grow exponentially and you see that you have to run another instance and this time it's running on port 5000 not really great but now the user is confused that hey should i be starting my application on 5000 4000 or probably other ports as well now this is also a classic problem and that is why a software like nginx comes in between what nginx does it says that hey users you probably are aware of already these famous ports ports like 443 or port 80 which by default your browser serves so you don't even have to remember these ports not only that it also puts a barrier wall so that your user doesn't have to bother about should i connect this port or that port or some weird looking port on which my application should be serving they just look at the application from this gateway that hey i'm going to use this application nginx on the other hand behind the scene actually takes all the requests from the user and wherever this application is serving is going to talk to nginx nginx smartly manages the load that which server or which instance is having a low amount of load i'm going to redirect the request on that port now if you are using this little bit smartly what you can do is you can handle some of the routes let's just say there's a route like courses you know that this is being served quite a lot so i want to dedicate an instance to serve only this route so that's a smart thing now cherry on the top is let's just say you have decided to roll out a new course yes i'm taking too much example about the courses but it makes much more sense in this case so let's just say you have rolled out a new course on react native which is serving on the port rn or the route rn so you know that people are going to be curious about this new course and they're going to be requesting a whole lot of things now so far what is happening whenever user makes a request every single time you talk to database and you serve that request but this time you know that the traffic is coming up it is expected so what nginx can do it can actually load up a simple cache that all the requests for this particular route i'm going to store that in cache so that it doesn't have to talk with database again and again and it can serve the request much more faster since it is not talking to the database and all the entire infrastructure again and again so this is just one such smaller example of how and why nginx is so much used in the production a lot of time people ask me that haiti show us how to put this mern mean or django application in production and i've seen so many people doing it just via the easy way they just take the application make a git request or somehow just put their application onto these servers and spin them off which i think is not a good way it's a shortcut and you shouldn't be taking shortcut i think my responsibility is to make sure that you are curious to know that how things are actually done in production how nginx comes into the picture how the load balancing is done how the caching is done and how to read more about nginx and the problem that it's trying to solve so my recommendation is don't be in a hurry don't try to just put the things into production with just one video it's a long process and eventually when you'll be working in a software or it company you will be doing that in a real way the production way the professional way so don't take the shortcut of just one video and throwing everything on that learn read more about nginx its configuration how things are done and that would be a much much better way of doing the things i'll probably try to make more videos in nginx but let me know in the comment section should i be doing it or not i'll pick up your comments and will decide the future of how things and videos should go up on this channel based only on your comments in the comment section so post them up in case you haven't hit that subscribe button yet probably consider that right now and also if you are not connected with me on instagram go ahead connect there most of the fun actually happens there post in the comment section if you need more such video or in-depth guide about nginx i would love to do that and let's catch up in the next video
Info
Channel: Hitesh Choudhary
Views: 70,650
Rating: 4.9270921 out of 5
Keywords: Programming, LearnCodeOnline, nginx, what is nginx, why to use nginx, hosting MEAN MERN, mern to production, mean to production, load balancing, http server
Id: WuH0T9FHDZ4
Channel Id: undefined
Length: 6min 41sec (401 seconds)
Published: Tue Dec 15 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.