<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Medhavi Siyambalapitiya on Medium]]></title>
        <description><![CDATA[Stories by Medhavi Siyambalapitiya on Medium]]></description>
        <link>https://medium.com/@medhavisiyambalapitiya?source=rss-fb65777e29eb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3-RjRa6o-0YqKiqC.</url>
            <title>Stories by Medhavi Siyambalapitiya on Medium</title>
            <link>https://medium.com/@medhavisiyambalapitiya?source=rss-fb65777e29eb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 10:29:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@medhavisiyambalapitiya/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The NGINX: A Comprehensive Introduction and Hands-On Guide]]></title>
            <link>https://medium.com/@medhavisiyambalapitiya/the-nginx-a-comprehensive-introduction-and-hands-on-guide-316b7adfff65?source=rss-fb65777e29eb------2</link>
            <guid isPermaLink="false">https://medium.com/p/316b7adfff65</guid>
            <category><![CDATA[nginx-architecture]]></category>
            <category><![CDATA[web-server]]></category>
            <category><![CDATA[nginx]]></category>
            <dc:creator><![CDATA[Medhavi Siyambalapitiya]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 05:05:39 GMT</pubDate>
            <atom:updated>2023-09-08T05:05:39.961Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KvNCiUYOfmxL_Llqm7UJLA.jpeg" /></figure><p>From the moment I embarked on my journey into the world of programming languages and computer science, I’ve been intrigued by the magic that unfolds when we enter a URL and press that ‘Enter’ key. We all know a webpage is an intricate blend of images, text files, database content, and more. But have you ever wondered about the wizardry that goes on behind the scenes when you request a web page?</p><p>Simply, when I type <em>“https://www.google.com&quot;</em> and hit enter, my browser dispatches a request across the vast expanse of the internet to a distant machine, one endowed with a piece of software known as a <strong>“Web Server”</strong>. This machine possesses the innate wisdom to interpret the request, fetch the correct information, and seamlessly deliver it back to my waiting browser.</p><p>Perhaps you’re curious about the enigmatic entity known as “Nginx.” Well, before we dive into its depths, let’s unravel the fundamental concepts: <em>“What is a Web Server?”</em> and <em>“What challenges does Nginx endeavor to solve?”</em> Once these mysteries are unveiled, everything related to Nginx will fall into place seamlessly.</p><p><strong>A Web Server is a vital piece of software responsible for serving web content to users.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z_9wWh-cuwKuw9Owur6LbQ.jpeg" /></figure><p>Six pivotal tasks unfold, almost like chapters in a compelling story, when a Web Server serves web content:</p><p><strong>1). LISTENS</strong></p><p><strong>2). ON A PORT</strong></p><p><strong>3). FOR A REQUEST </strong>sent via</p><p><strong>4). TRANSPORT PROTOCOL </strong>and returns a</p><p><strong>5). RESPONSE</strong> containing the</p><p><strong>6). REQUESTED RESOURCE</strong>.</p><p>In today’s web-centric world, building websites has become so streamlined that web servers are no longer a primary concern. They’ve become a commodity, readily available with most hosting services. However, if you find yourself intrigued by how web servers operate and the possibility of deploying your own, then this article holds great promise for your exploration.</p><h4><strong>Examples of Web Servers:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VlvdMrEqivSj7X8ADGMd_Q.jpeg" /></figure><p>So let’s go ahead and look at <em>“What is Nginx?”</em> and <em>“Why to use Nginx?”</em></p><p><strong>“Nginx”</strong>, you see, is not merely a web server; it’s a versatile entity with additional capabilities, including acting as a reverse proxy, load balancer, mail proxy, and HTTP cache. Its virtues include:</p><p>· Ease of installation and maintenance</p><p>· Reduced user wait times</p><p>· Load Balancing</p><p>· Scalability</p><p>· On-the-fly upgrades</p><p>With Nginx at your side, you’ll witness a remarkable reduction in page load times, ensuring a seamless user experience. With this clarity on Nginx’s attributes, let’s proceed to explore the architecture that powers it.</p><h4><strong>Nginx Architecture</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dsCKyXcfIAIZlkIiU9XHvQ.jpeg" /><figcaption>Nginx orchestrates its operations with the grace of a masterful conductor, following a Master-Slave Architecture while embracing Event-Driven, Asynchronous, and Non-Blocking Models.</figcaption></figure><p>· <strong>Event-driven</strong>: It means that notifications or signals are used to mark the initiation or completion of a process. Thus, the resources can be used by another process until a process initiation event is triggered and resources can be allocated and released dynamically. This leads to the optimized use of memory and CPU.</p><p>· <strong>Asynchronous</strong>: It means that the threads can be executed concurrently without blocking each other. It enhances the sharing of resources without being dedicated and blocked.</p><p>· <strong>Single-Threaded</strong>: It means that multiple clients can be handled by a single worker process as the resources are not blocked.</p><p><strong>Nginx comprises four key components:</strong></p><p>· <strong>The Master Process</strong>: It performs the privileged operations such as reading configuration and binding to ports and then creates a small number of child processes</p><p>·<strong> The Cache Loader Process</strong>: It runs at startup to load the disk‑based cache into memory and then exits. It is scheduled conservatively, so its resource demands are low.</p><p>· <strong>The Cache Manager Process</strong>: It diligently prunes entries from disk caches, ensuring they adhere to configured sizes.</p><p>· <strong>The Worker Processes</strong>: They handle network connections, read and write content to disk, and communicate with upstream servers.</p><h4><strong>How to Install Nginx and Get Hands-On</strong></h4><p>Believe it or not, you’re just three steps away from having Nginx installed on your machine for experimentation:</p><ol><li>Step 1: Log in to your Virtual Machine.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*Ezlrs1sR6O6DUBMgtlPGYg.jpeg" /></figure><p>2. Step 2: Update your Virtual Machine with this command:</p><pre>sudo apt-get update</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*pgJq9AY09VYW_F1o_JE1GQ.jpeg" /></figure><p>3. Step 3: Install Nginx using:</p><pre>sudo apt-get install nginx</pre><p>When prompted with “Do you want to continue,” confirm your intent by typing “Y.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nsy8C3qvcNw3srfj9yVt4g.jpeg" /></figure><p>4. Step 4: Verify Nginx installation with the command:</p><pre>nginx -v</pre><p>You’ll see the version information, such as “Nginx version 1.10.3 on Ubuntu.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*YKT5fJLAuOUA5ptcBm-Oqg.jpeg" /></figure><p>5. Step 5: To ensure Nginx is running, use:</p><pre>sudo systemctl status nginx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ro7F8bDQkcaprJx1TK_tw.jpeg" /></figure><p><strong>Additionally, familiarize yourself with essential Nginx commands:</strong></p><p>As you immerse yourself in this hands-on experience, keep in mind that managing Nginx is a breeze with these essential commands:</p><p>You just need to type a single command to just restart, refresh, or anything.</p><p>· To enable nginx to start when your system boosts:</p><pre>sudo systemctl enable nginx</pre><p>· To start nginx:</p><pre>sudo systemctl start nginx</pre><p>· If we edit or change the configuration file, we need to reload it using the below command:</p><pre>sudo nginx -s reload</pre><p>· To restart nginx:</p><pre>sudo systemctl restart nginx</pre><p>· To check the status of nginx (active/inactive):</p><pre>sudo systemctl status nginx</pre><p>· To make sure no syntax errors in nginx files:</p><pre>sudo nginx -t</pre><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=316b7adfff65" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>