The article has been published here https://www.linkedin.com/pulse/lets-play-vpc-using-docker-ngnix-nodejs-jahid-hasan-q9fjc/
Once I was asked "When you type www.google.com in your browser and hit enter, What happens ?" in an interview more than an years ago. I was not able to answer of this question properly at that time. After that I started study on it and finally able to know the complete follow.
After an years later, one of my friends called me from USA, She was about to complete her Master of Science in Civil Engineering from a well known university there. She told me that she is trying to enter her university's website by her computer but it's not working there. She switched her network in different wifi/mobile zone, but didn't worked as well. but by her phone she can browse it. What happened she doesn't know. so she visited the IT office of that university to resolve that or to check is her ip is blocked or not by any chance. They also couldn't help her much and finally she called me to have a look at that problem.
How computer communicates through internet / intranet?. Well, we all know it's through the IP address. But what happened when we type 'www.google.com' ? it's not an IP address. how could we get the IP address then?
Well in our computer's network system, there is a port 53 which is responsible to DNS resolution. What doest it work actually? It calls a DNS Server with the following url (e.g 'www.google.com') & receive the IP address corresponding to the DNS.
computer to DNS communication
So after few diagnose of my friend's laptop something like trying to request the url using curl, using incognito mode, etc nothing happened. then after few minutes of brain warms I go to her computer's network system, there I just changed the DNS server route to 8.8.8.8 (Google's DNS server). Though there is used DHCP as default which means the DNS server's ip will get from the router or ISP automatically. And it solved. She was able browse her university's website from her laptop.
Next, the computer network system knows the IP address now, so It can communicate now with other computers / servers through IP address.
Hence our computer network system now checks the protocol. is it HTTP or HTTPS, if it's HTTP, then the request goes through the PORT 80, else it goes thorough the PORT 443. So from that Port our computer communicate with they Google's Server. It might be a proxy server of google, or a gateway or anything that google placed there.
So if the PORT is 80, then Data will be pass as plain text, else if 443, then Data will be passed securely
Computer to server communication
And you can receive response of each request with the following mechanism. response may vary in different formats. data get as binary format but your application's programming language / frameworks parse it as required formats & present it to you.
If you do not mention the http or https in the browser while writing the urls, browser smartly handle the requests that which should be go through 80 and which should go 443. Most of the modern browser use 443 as it's the best practice with secure data communication, but some browsers use 80 as it is must open to receive the request even there is no ssl certification.
So if someone asked you which PORT of your computer get the request first when you hit enter after writing an url in your browser, You can answer it easily. Pardon me if there are any mistakes in the above, helps me to improve.
Thank you
