<?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>DEV Community: Bruce</title>
    <description>The latest articles on DEV Community by Bruce (@knowbee).</description>
    <link>https://dev.to/knowbee</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%2F403684%2F85b29abf-abb4-43a6-a559-7342d18e2c84.jpg</url>
      <title>DEV Community: Bruce</title>
      <link>https://dev.to/knowbee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/knowbee"/>
    <language>en</language>
    <item>
      <title>Simplifying Video Downloads from Wistia</title>
      <dc:creator>Bruce</dc:creator>
      <pubDate>Mon, 03 Jul 2023 11:26:58 +0000</pubDate>
      <link>https://dev.to/knowbee/simplifying-video-downloads-from-wistia-231f</link>
      <guid>https://dev.to/knowbee/simplifying-video-downloads-from-wistia-231f</guid>
      <description>&lt;p&gt;GitHub Repository: &lt;a href="https://github.com/knowbee/wisty" rel="noopener noreferrer"&gt;wisty&lt;/a&gt;&lt;br&gt;
Pypi: &lt;a href="https://pypi.org/project/wisty" rel="noopener noreferrer"&gt;wisty&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this small article, we will explore &lt;strong&gt;Wisty&lt;/strong&gt;, a command line tool designed to swiftly download videos hosted on Wistia written in python and open sourced. With &lt;strong&gt;Wisty&lt;/strong&gt;, you can effortlessly save Wistia videos to your local machine in just a few simple steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started:
&lt;/h2&gt;

&lt;p&gt;To begin, you'll need to have Python installed on your system. Once Python is set up, you can easily install Wisty by running the following command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

pip install wisty


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Downloading Videos from Wistia:
&lt;/h2&gt;
&lt;h5&gt;
  
  
  1. Obtain the Video ID:
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Right-click on the Wistia video you want to download.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select "Copy link and Thumbnail."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Paste the link into a text file reader.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Locate the video ID, which will be labeled as "&lt;strong&gt;wvideo&lt;/strong&gt;" followed by a value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy the video ID value for later use.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
  
  
  2. Download the Video:
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open your command line or terminal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run the following command, replacing &lt;strong&gt;video_id&lt;/strong&gt; with the actual video ID you obtained earlier:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

wisty download &amp;lt;video_id&amp;gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Wisty will initiate the download process, and the video will be saved to your current working directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Example:
&lt;/h2&gt;

&lt;p&gt;Let's say you want to download a video with the ID &lt;strong&gt;123abc&lt;/strong&gt;. You would execute the following command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

wisty download 123abc


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqarviqml6dlnl4j3jw7y.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqarviqml6dlnl4j3jw7y.jpeg" alt="example-image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wisty&lt;/strong&gt; will then swiftly retrieve the video from Wistia and save it to your local machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Wisty&lt;/strong&gt; simplifies the process of downloading Wistia videos by providing a minimalistic and efficient command line interface. With just a video ID, you can quickly retrieve and save Wistia videos to your local machine hassle-free.&lt;/p&gt;

&lt;p&gt;Give &lt;strong&gt;Wisty&lt;/strong&gt; a try today, and enjoy the ease and convenience it brings to downloading Wistia videos!&lt;/p&gt;

&lt;p&gt;GitHub Repository: &lt;a href="https://github.com/knowbee/wisty" rel="noopener noreferrer"&gt;wisty&lt;/a&gt;&lt;br&gt;
Pypi: &lt;a href="https://pypi.org/project/wisty" rel="noopener noreferrer"&gt;wisty&lt;/a&gt;&lt;/p&gt;

</description>
      <category>wistia</category>
      <category>downloader</category>
      <category>python</category>
      <category>cli</category>
    </item>
    <item>
      <title>How to download courses from Linkedin Learning with python</title>
      <dc:creator>Bruce</dc:creator>
      <pubDate>Mon, 29 Mar 2021 08:41:21 +0000</pubDate>
      <link>https://dev.to/knowbee/how-to-download-courses-from-linkedin-learning-with-python-5aff</link>
      <guid>https://dev.to/knowbee/how-to-download-courses-from-linkedin-learning-with-python-5aff</guid>
      <description>&lt;p&gt;In this tutorial we will see how to download Linkedin learning courses with a simple cli tool. Just a quick setup and you will be able to download videos and courses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;We will need Python3.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.tutorialdocs.com/tutorial/python3/setup-guide.html" rel="noopener noreferrer"&gt;Python 3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Now, what's next?
&lt;/h2&gt;

&lt;p&gt;Open your terminal or command line and download a python package from PyPi called &lt;code&gt;llvd&lt;/code&gt; which stands for Linkedin Learning Video Downloader&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pip install llvd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If you have multiple versions of python installed in your system, use &lt;strong&gt;pip3&lt;/strong&gt; instead.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


    $ llvd --help



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If the above command does not fail, you can continue with the tutorial&lt;/p&gt;

&lt;h2&gt;
  
  
  To download a course:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Log in to the Linkedin Learning app.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Search for any course.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7bxhalsbnp1milpdo8y6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7bxhalsbnp1milpdo8y6.png" alt="sc2"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to the course of your choice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy its slug.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fih00o32yax4cz2ls78bf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fih00o32yax4cz2ls78bf.png" alt="one"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open your terminal or command line.&lt;/li&gt;
&lt;li&gt;Copy the command given below and replace &lt;code&gt;course-slug&lt;/code&gt; with your copied course slug and run it&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


    $ llvd -c "course-slug" -r 720



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;llvd&lt;/code&gt; creates separate folders for each course you download, groups all videos by chapters, and renames all downloaded videos with video names so that they will be ordered properly.&lt;/p&gt;

&lt;p&gt;To download a course you have to specify its name (&lt;code&gt;-c&lt;/code&gt; flag ).&lt;/p&gt;

&lt;h2&gt;
  
  
  How it looks like in action
&lt;/h2&gt;

&lt;p&gt;
    &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fknowbee%2Fhosting%2Fmaster%2Fassets%2Fprogress_llvd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fknowbee%2Fhosting%2Fmaster%2Fassets%2Fprogress_llvd.png"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Available features with this tool
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cookie-based authentication&lt;/li&gt;
&lt;li&gt;Download a course and all its exercises&lt;/li&gt;
&lt;li&gt;Group videos by chapters&lt;/li&gt;
&lt;li&gt;Ability to download video subtitles(by specifying &lt;code&gt;--caption&lt;/code&gt; flag)&lt;/li&gt;
&lt;li&gt;Ability to resume failed downloads&lt;/li&gt;
&lt;li&gt;Option to choose video format (360p, 540p, 720p) using &lt;code&gt;-r&lt;/code&gt; flag&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cookie-based Authentication
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Click on the options in google chrome (top right with 3 vertical dots).&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After this, click on more tools followed by Developer Tools (you can also reach here by using the keyboard combination — &lt;code&gt;ctrl+shift+I&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now once you’ve gained access to the developer tools, navigate to the Application tab, and copy the value of two cookies from there named &lt;code&gt;li_at&lt;/code&gt; and &lt;code&gt;JSESSIONID&lt;/code&gt; respectively.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a cookies.txt file to a place you want to download your courses then paste in the values of &lt;code&gt;li_at&lt;/code&gt; and &lt;code&gt;JSESSIONID&lt;/code&gt; as shown below.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

  &lt;span class="nv"&gt;li_at&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;xxxxx
  &lt;span class="nv"&gt;JSESSIONID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"ajax:xxxxxx"&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


      $ llvd -c "course-slug" -r 720 --cookies



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Download the course with subtitles
&lt;/h3&gt;

&lt;p&gt;Use the &lt;code&gt;--caption&lt;/code&gt; flag to download videos with subtitles&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


    $ llvd -c "course-slug" -r 720 --caption


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;or&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ llvd -c "course-slug" -r 720 -ca
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Wrapping up&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;If you liked this tutorial you might as well head over to Github and leave a star to this awesome open source project &lt;a href="https://github.com/knowbee/llvd" rel="noopener noreferrer"&gt;llvd&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading 😊!&lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
      <category>linkedin</category>
      <category>github</category>
    </item>
    <item>
      <title>How to setup secure subdomains using nginx and certbot on a VPS</title>
      <dc:creator>Bruce</dc:creator>
      <pubDate>Tue, 09 Jun 2020 18:29:16 +0000</pubDate>
      <link>https://dev.to/knowbee/how-to-setup-secure-subdomains-using-nginx-and-certbot-on-a-vps-4m8h</link>
      <guid>https://dev.to/knowbee/how-to-setup-secure-subdomains-using-nginx-and-certbot-on-a-vps-4m8h</guid>
      <description>&lt;p&gt;Did you know that you can host as many subdomains as you want thanks to nginx on a VPS?&lt;/p&gt;

&lt;p&gt;Well if you don't know how to do that, reading this tutorial is going to help you setup subdomains assuming that you already have a domain setup already.&lt;/p&gt;

&lt;p&gt;Here's the general assumption for this setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ubuntu server&lt;/li&gt;
&lt;li&gt;A fully registered domain name: example.com (use your real domain name)&lt;/li&gt;
&lt;li&gt;Subdomain names: dashboard.example.com, shop.example.com&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before starting this tutorial, first thing you've to do is to point all your subdomains to your server’s public IP address via your DNS provider (edit A, CNAME).&lt;/p&gt;

&lt;p&gt;I am using DigitalOcean because of how easy it is to get started. If you can sign up on DigitalOcean with my &lt;a href="https://m.do.co/c/139ece3a635f" rel="noopener noreferrer"&gt;Referral Link&lt;/a&gt; you get $100 in credit that can be spent in 60 days.&lt;/p&gt;

&lt;p&gt;Well enough with talking let's jump straight to it:&lt;/p&gt;

&lt;h3&gt;
  
  
  1 - SSH into your VPS
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;ssh user@hostname
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2 - Install and start nginx
&lt;/h3&gt;

&lt;p&gt;Use the following command to install nginx on your VPS&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="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;nginx

&lt;span class="c"&gt;# start nginx service&lt;/span&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3 - Setup the test directories for each subdomain
&lt;/h3&gt;

&lt;p&gt;Up until now, all the subdomains have set up correctly but there is one huge problem, all are pointing to the same page. We need to separate these subdomains to point to their own pages. For this, i'm going to setup test directories and html pages.&lt;/p&gt;

&lt;h4&gt;
  
  
  Creating directories for each subdomain
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /var/www

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo mkdir &lt;/span&gt;shop.example.com dashboard.example.com

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Creating simple html pages for each
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;
&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Example.com&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;It works&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Copy and paste the code above in each of the html files
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano shop.example.com/index.html
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano dashboard.example.com/index.html

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4 - Creating server blocks for each subdomain
&lt;/h3&gt;



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

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside /etc/nginx/sites-available. We are going to create server block for each subdomains and do modifications for each.We are also going to create symbolic link of each 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="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano dashboard.example.com

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Copy and paste the configurations given below
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="c"&gt;## For dashboard.example.com subdomain&lt;/span&gt;
server &lt;span class="o"&gt;{&lt;/span&gt;
        listen 80&lt;span class="p"&gt;;&lt;/span&gt;
        listen &lt;span class="o"&gt;[&lt;/span&gt;::]:80&lt;span class="p"&gt;;&lt;/span&gt;
        root /var/www/dashboard.example.com&lt;span class="p"&gt;;&lt;/span&gt;
        index index.html&lt;span class="p"&gt;;&lt;/span&gt;
        server_name dashboard.example.com www.dashboard.example.com&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Make a symbolic link
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; /etc/nginx/sites-available/dashboard.example.com /etc/nginx/sites-enabled/dashboard.example.com

&lt;span class="c"&gt;# do the same for the other subdomain&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5 - Testing
&lt;/h3&gt;



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

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you head over to each of the subdomains in your browser you are going to see that it works but you notice that the browser is screaming at you that there is no ssl certificate &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hold on, we are going to fix that, plus there is a bonus..so keep on reading&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  6 - Install Certbot and generate SSL Certificate
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; certbot

&lt;span class="c"&gt;# stop nginx service, this is a must&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl stop nginx

&lt;span class="c"&gt;# generate an ssl certificate&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;certbot certonly &lt;span class="nt"&gt;-d&lt;/span&gt; shop.example.com &lt;span class="nt"&gt;-d&lt;/span&gt; dashboard.example.com

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hit enter and you are going to see this menu of options&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;How would you like to authenticate with the ACME CA?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Nginx Web Server plugin &lt;span class="o"&gt;(&lt;/span&gt;nginx&lt;span class="o"&gt;)&lt;/span&gt;
2: Spin up a temporary webserver &lt;span class="o"&gt;(&lt;/span&gt;standalone&lt;span class="o"&gt;)&lt;/span&gt;
3: Place files &lt;span class="k"&gt;in &lt;/span&gt;webroot directory &lt;span class="o"&gt;(&lt;/span&gt;webroot&lt;span class="o"&gt;)&lt;/span&gt;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number &lt;span class="o"&gt;[&lt;/span&gt;1-3] &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;enter] &lt;span class="o"&gt;(&lt;/span&gt;press &lt;span class="s1"&gt;'c'&lt;/span&gt; to cancel&lt;span class="o"&gt;)&lt;/span&gt;: 2

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Choose the second option and press ENTER, that's it .Now we have to do one more last thing and we are done. We need to tell nginx how to handle non secure connections.&lt;/p&gt;

&lt;h3&gt;
  
  
  7 - Redirect all HTTP traffic to HTTPS
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /etc/nginx/sites-available
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano dashboard.example.com

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update the server block with these configurations&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="c"&gt;# dashboard.example.com subdomain server block&lt;/span&gt;
server &lt;span class="o"&gt;{&lt;/span&gt;
    listen 80&lt;span class="p"&gt;;&lt;/span&gt;
    listen &lt;span class="o"&gt;[&lt;/span&gt;::]:80&lt;span class="p"&gt;;&lt;/span&gt;
    server_name dashboard.example.com www.dashboard.example.com&lt;span class="p"&gt;;&lt;/span&gt;
    error_page 497 https://dashboard.example.com&lt;span class="nv"&gt;$request_uri&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;301 https://dashboard.example.com&lt;span class="nv"&gt;$request_uri&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

server &lt;span class="o"&gt;{&lt;/span&gt;
    listen 443 ssl&lt;span class="p"&gt;;&lt;/span&gt;
    root /var/www/dashboard.example.com&lt;span class="p"&gt;;&lt;/span&gt;
    index index.html index.htm&lt;span class="p"&gt;;&lt;/span&gt;
    server_name www.dashboard.example.com&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c"&gt;# ssl configuration;&lt;/span&gt;
    ssl_certificate /etc/letsencrypt/live/dashboard.example.com/fullchain.pem&lt;span class="p"&gt;;&lt;/span&gt;
    ssl_certificate_key /etc/letsencrypt/live/dashboard.example.com/privkey.pem&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;return &lt;/span&gt;301 https:/dashboard.example.com&lt;span class="nv"&gt;$request_uri&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
server &lt;span class="o"&gt;{&lt;/span&gt;
    listen 443 ssl&lt;span class="p"&gt;;&lt;/span&gt;
    root /var/www/dashboard.example.com&lt;span class="p"&gt;;&lt;/span&gt;
    index index.html index.htm&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c"&gt;# ssl configuration;&lt;/span&gt;
    ssl_certificate /etc/letsencrypt/live/dashboard.example.com/fullchain.pem&lt;span class="p"&gt;;&lt;/span&gt;
    ssl_certificate_key /etc/letsencrypt/live/dashboard.example.com/privkey.pem&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;# do the same for the other subdomain file and make sure you replace subdomain name&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You notice in the server block we are telling nginx where to look for our generated ssl certificate key and i have also added www redirection configurations as a bonus 😉!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Make sure to add an A record with &lt;a href="http://www.dashboard.example.com" rel="noopener noreferrer"&gt;www.dashboard.example.com&lt;/a&gt; and &lt;a href="http://www.shop.example.com" rel="noopener noreferrer"&gt;www.shop.example.com&lt;/a&gt; pointing to your server’s public IP address.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  8 - Test again and Restart nginx service
&lt;/h3&gt;



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

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And there you have it. Our nginx server is redirecting all www traffic to non-www over SSL. The configuration is also telling nginx to redirect all HTTP traffic to HTTPS to make sure we are secure.&lt;/p&gt;

&lt;h3&gt;
  
  
  Thank you for reading!
&lt;/h3&gt;

&lt;p&gt;Your comments are welcome&lt;/p&gt;

</description>
      <category>devops</category>
      <category>nginx</category>
      <category>server</category>
      <category>certbot</category>
    </item>
    <item>
      <title>How to setup continuous deployment of a website on a VPS using GitHub Actions</title>
      <dc:creator>Bruce</dc:creator>
      <pubDate>Mon, 08 Jun 2020 09:08:55 +0000</pubDate>
      <link>https://dev.to/knowbee/how-to-setup-continuous-deployment-of-a-website-on-a-vps-using-github-actions-54im</link>
      <guid>https://dev.to/knowbee/how-to-setup-continuous-deployment-of-a-website-on-a-vps-using-github-actions-54im</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Doesn't matter if it is a private or public repository&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Here are the prerequisites required for this tutorial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;a href="https://github.com" rel="noopener noreferrer"&gt;GitHub account&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Any Virtual Private Server, though i prefer DigitalOcean because of how easy it is to get started. If you can sign up on DigitalOcean with my &lt;a href="https://m.do.co/c/139ece3a635f" rel="noopener noreferrer"&gt;Referral Link&lt;/a&gt; you get $100 in credit that can be spent in 60 days.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Some of the things we are going to cover in this tutorial.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Generating an ssh key on your remote VPS&lt;/li&gt;
&lt;li&gt;Adding your generated public key to authorized keys&lt;/li&gt;
&lt;li&gt;Creating GitHub secret keys&lt;/li&gt;
&lt;li&gt;Configuring GitHub actions to auto-deploy your private/public repository&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Step 1 - Open your terminal add ssh into your VPS
&lt;/h4&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;ssh user@hostname
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/.ssh


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Step 2 - Generate an ssh key
&lt;/h4&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt; ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; rsa &lt;span class="nt"&gt;-b&lt;/span&gt; 4096 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"test@example.com"&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;The email is the one you use on your GitHub account&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Step 3: Press Enter repeatedly to set default name(Don't set a passphrase)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;If you do "ls" in your terminal you will see these two files ( id_rsa and id_rsa.pub)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Step 4 - Add a public key to authorized keys
&lt;/h4&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt; &lt;span class="nb"&gt;cat&lt;/span&gt; ~/.ssh/id_rsa.pub &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.ssh/authorized_keys


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Note: We’re using &amp;gt;&amp;gt; so that the id_rsa.pub contents are appended to the end of the contents in the authorized_keys file, rather than override the contents in the authorized_keys.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Step 5 - Create GitHub secrets
&lt;/h4&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt; &lt;span class="nb"&gt;cat&lt;/span&gt; ~/.ssh/id_rsa


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;In your terminal run the above command select the output content and copy to your clipboard.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj5lm5tfqchujl4onk78x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj5lm5tfqchujl4onk78x.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Head over to your GitHub repository you wish to configure,click on settings tab then in options menu click on  and add the following secrets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;HOST: set the key to your hostname or ip address.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;USERNAME: set the key to the username you use to SSH into your VPS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SSHKEY: set the key to you copied contents from the command above.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PORT: set the key to 22&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftu1ojiihntg9n2rxz632.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftu1ojiihntg9n2rxz632.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are still here, congratulations! we are almost done!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;With the steps above completed, we’re left with only a single step more, namely, our .github/workflows/deploy.yml file.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Step 6 - Configure GitHub actions to auto-deploy your private/public repository
&lt;/h4&gt;

&lt;p&gt;Assuming that you have the repo cloned locally on your machine, go ahead and create .github/workflows folder and inside that create a deploy.yml file&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the following contents to deploy.yml file&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

name: Deploy

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1

    - name: Copy repository contents via scp
      uses: appleboy/scp-action@master
      env:
        HOST: ${{ secrets.HOST }}
        USERNAME: ${{ secrets.USERNAME }}
        PORT: ${{ secrets.PORT }}
        KEY: ${{ secrets.SSHKEY }}
      with:
        source: "."
        target: "/var/www/mywebsite"

    - name: Executing remote command
      uses: appleboy/ssh-action@master
      with:
        host: ${{ secrets.HOST }}
        USERNAME: ${{ secrets.USERNAME }}
        PORT: ${{ secrets.PORT }}
        KEY: ${{ secrets.SSHKEY }}
        script: ls


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice that my remote command is just " ls ".if you are trying to auto deploy a React App or a Vue App, you could set your script command to Build command.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  The Moment of Truth!
&lt;/h3&gt;

&lt;p&gt;Commit the deploy.yml changes, and push to your repository.&lt;/p&gt;

&lt;p&gt;It should build and push to the VPS without any errors.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt; git add &lt;span class="nb"&gt;.&lt;/span&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt; git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"deploy"&lt;/span&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt; git push origin master


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If you head over to your GitHub repository and click on actions menu you shall see this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4sj5vax87nse3sn36w60.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4sj5vax87nse3sn36w60.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Yay ! That's it, your repository is officially configured, now everytime you make changes and push to GitHub that action will run and auto deploy your website.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkj91iyxwqo07by63hu4u.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkj91iyxwqo07by63hu4u.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Thank you for reading!
&lt;/h3&gt;

&lt;p&gt;Your comments are welcome&lt;/p&gt;

</description>
      <category>github</category>
      <category>devops</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
