<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mayank Soni</title>
    <description>The latest articles on Forem by Mayank Soni (@mayanxoni).</description>
    <link>https://forem.com/mayanxoni</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F239691%2F9eddd41a-557d-4f9a-b9ed-8c9a434cfc9e.jpeg</url>
      <title>Forem: Mayank Soni</title>
      <link>https://forem.com/mayanxoni</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mayanxoni"/>
    <language>en</language>
    <item>
      <title>Securing Your Node.js App on AWS EC2: A Guide to Nginx, Let's Encrypt, and Custom Domains</title>
      <dc:creator>Mayank Soni</dc:creator>
      <pubDate>Tue, 16 Jan 2024 12:44:31 +0000</pubDate>
      <link>https://forem.com/mayanxoni/securing-your-nodejs-app-on-aws-ec2-a-guide-to-nginx-lets-encrypt-and-custom-domains-33e8</link>
      <guid>https://forem.com/mayanxoni/securing-your-nodejs-app-on-aws-ec2-a-guide-to-nginx-lets-encrypt-and-custom-domains-33e8</guid>
      <description>&lt;p&gt;In today's digital landscape, security is paramount. This guide aims to walk you through the process of securing your Node.js application on an AWS EC2 instance. We'll cover configuring Nginx, obtaining a free SSL certificate from Let's Encrypt, and setting up a custom domain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: SSH into your EC2 instance
&lt;/h2&gt;

&lt;p&gt;Login to you instance with your instance username and Key File:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh  &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"PATH/TO/YOUR/KEY/FILE.PEM"&lt;/span&gt; &lt;span class="s2"&gt;"USER-NAME@SERVER-IP"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Install Nginx and Certbot
&lt;/h2&gt;

&lt;p&gt;If you haven't already installed Nginx, you can do so using your package manager. For example, on a Debian-based system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;nginx certbot python3-certbot-nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(python3-certbot-nginx is an Nginx plugin for Certbot)&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Configure Nginx for Your Node.js App
&lt;/h2&gt;

&lt;p&gt;Begin by installing Nginx on your EC2 instance. You can create a dedicated Nginx configuration file tailored for your Node.js app, but I'm using the default configuration file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/nginx/sites-available/default
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file directs Nginx to act as a reverse proxy, forwarding requests to your Node.js application. Remember to replace &lt;em&gt;YOUR-DOMAIN-NAME.TLD&lt;/em&gt; with your domain name in this snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;YOUR-DOMAIN-NAME.TLD&lt;/span&gt; &lt;span class="s"&gt;WWW.YOUR-DOMAIN-NAME.TLD&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_pass&lt;/span&gt; &lt;span class="s"&gt;http://127.0.0.1:PORT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ensure your Node.js app is running on the specified port (PORT in the Nginx configuration).&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Obtain a Free SSL Certificate with Let's Encrypt
&lt;/h2&gt;

&lt;p&gt;Enhance your website's security by obtaining a free SSL certificate from Let's Encrypt. Install Certbot and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;certbot &lt;span class="nt"&gt;--nginx&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; YOUR-DOMAIN-NAME.TLD &lt;span class="nt"&gt;-d&lt;/span&gt; WWW.YOUR-DOMAIN-NAME.TLD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Certbot will prompt you for necessary information and automatically configure Nginx to use the SSL certificate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Configure Certbot Auto-Renewal
&lt;/h2&gt;

&lt;p&gt;Certificates obtained from Let's Encrypt are typically valid for 90 days. To automate the renewal process, Certbot provides a renewal script that you can set up with a cron job.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;certbot renew &lt;span class="nt"&gt;--dry-run&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command tests the renewal process without making any changes. If it runs without errors, you can add it to your crontab.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;crontab &lt;span class="nt"&gt;-e&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following line to run the renewal check twice a day:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;0 &lt;span class="k"&gt;*&lt;/span&gt;/12 &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; /usr/bin/certbot renew &lt;span class="nt"&gt;--quiet&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 6: Restart Nginx
&lt;/h2&gt;

&lt;p&gt;Before restarting Nginx, it's a good idea to test the configuration to catch any syntax errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nginx &lt;span class="nt"&gt;-t&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the test is successful, restart Nginx to apply the changes restart Nginx to apply the changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;service nginx restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, your site should be accessible using HTTPS, and the SSL certificate will automatically renew when necessary. Make sure to check your website to ensure that it's loading securely over HTTPS.&lt;/p&gt;

&lt;p&gt;If you encounter any issues, feel free to ask in the comments for further assistance!&lt;/p&gt;

</description>
      <category>ec2</category>
      <category>node</category>
      <category>aws</category>
      <category>nginx</category>
    </item>
    <item>
      <title>My Experience Building A Python Project</title>
      <dc:creator>Mayank Soni</dc:creator>
      <pubDate>Wed, 20 May 2020 15:28:42 +0000</pubDate>
      <link>https://forem.com/mayanxoni/my-experience-building-a-python-project-51jk</link>
      <guid>https://forem.com/mayanxoni/my-experience-building-a-python-project-51jk</guid>
      <description>&lt;h2&gt;
  
  
  My Final Project:
&lt;/h2&gt;

&lt;p&gt;FaceAttend - It's an attendance recording system that uses the power of facial recognition (through OpenCV) and marks attendance by detecting faces from the camera without redundantly capturing them more than once. It also has a feature that lets you see the analytical data of a particular student/class for determining the performance of either one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Code:
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A9-wwsHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/mayanxoni"&gt;
        mayanxoni
      &lt;/a&gt; / &lt;a href="https://github.com/mayanxoni/FaceAttend"&gt;
        FaceAttend
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Project for MCA final year. For more, README.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;FaceAttend&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;
  &lt;a href="https://github.com/mayanxoni/FaceAttend" alt="FaceAttend Logo"&gt;
    &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pwWnFiqc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://raw.githubusercontent.com/mayanxoni/FaceAttend/master/splash.png"&gt;
  &lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/mayanxoni/FaceAttend/issues"&gt;&lt;img src="https://camo.githubusercontent.com/3270f87d746026c2de2a083a492921f19601cf2ea4bf15ee8098a25a6d67dc22/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c642532307374617475732d696e25323070726f676573732d677265656e" alt="Build Status"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;FaceAttend is a minor project for the final year of my MCA course work. It is an attendance management software that harnesses the power of ML and AI (in a broad sense) to record attendance using Facial Recognition. It is built upon Python and uses OpenCV library to recognise faces from live video feed or even a picture.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Features&lt;/h1&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Manual Attendance&lt;/li&gt;
&lt;li&gt;Automatic Attendance&lt;/li&gt;
&lt;li&gt;Update Attendance (Manually)&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;References&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;FaceAttend is developed with the help of a number of references from the Internet:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/playlist?list=PLnjEM1fs09cGGjdCLSue8Kw7GmWDhGlMh" rel="nofollow"&gt;Codacus&lt;/a&gt; - OpenCV and Python Tutorial&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.opencv.org/3.4/db/d28/tutorial_cascade_classifier.html" rel="nofollow"&gt;OpenCV&lt;/a&gt; - Cascade Classifier&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Installation&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;FaceAttend requires &lt;a href="http://python.org/" rel="nofollow"&gt;Python&lt;/a&gt; v3.7+ to run.&lt;/p&gt;

&lt;p&gt;Once installed, run the following commands in your system shell to install necessary packages:&lt;/p&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;$ pip install opencv-contrib-python
$ pip install opencv-python
$ pip install numpy&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;License&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;MIT&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is it free? Hell yeah!&lt;/strong&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/mayanxoni/FaceAttend"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;h2&gt;
  
  
  How I built it (what's the stack? did I run into issues or discover something new along the way?):
&lt;/h2&gt;

&lt;p&gt;I used Python 3.7.2 along with Qt for building it's beautiful GUI that helps it look more professional than it is. I thought it would be impossible for me to build a project under 4 months using a language that I thought was horrible but with the help of open-source content available on GitHub and open forums like Stackoverflow, I was able to pull it off easily.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Thoughts / Feelings / Stories:
&lt;/h2&gt;

&lt;p&gt;I feel that building a solution using a particular language/stack should not matter as long as you think that the solution you're building itself is a life-changing product.&lt;/p&gt;

</description>
      <category>octograd2020</category>
      <category>devgrad2020</category>
      <category>githubsdp</category>
      <category>python</category>
    </item>
  </channel>
</rss>
