<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Web Hosting - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Web Hosting - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Thu, 25 Jun 2026 10:02:32 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/web-hosting/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Host Your Project on GitHub – Explained With Examples ]]>
                </title>
                <description>
                    <![CDATA[ Seven years ago, I began my journey into web development with HTML and CSS. As soon as I got the hang of JavaScript, I built my first website. The excitement was overwhelming, and I wanted to share it with my friends and the world. Like many beginner... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/host-your-first-project-on-github/</link>
                <guid isPermaLink="false">66d46156182810487e0ce1be</guid>
                
                    <category>
                        <![CDATA[ deployment ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Git ]]>
                    </category>
                
                    <category>
                        <![CDATA[ GitHub ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Spruce Emmanuel ]]>
                </dc:creator>
                <pubDate>Thu, 08 Aug 2024 11:37:16 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/08/Screenshot-2024-08-04-at-11.47.51-PM.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Seven years ago, I began my journey into web development with HTML and CSS. As soon as I got the hang of JavaScript, I built my first website. The excitement was overwhelming, and I wanted to share it with my friends and the world.</p>
<p>Like many beginners, I started researching hosting platforms, only to find out about the cost of domains and hosting. That's when I discovered Git and GitHub, realizing I could share my projects without spending a dime.</p>
<p>If you're in the same boat, unsure about Git and GitHub and how to share your projects, this article is for you. It's the guide I wish I had seven years ago.</p>
<p>To demonstrate the power of Git and GitHub, we'll be using a real-world project as an example. Let's take the "IP Address Tracker application" project from <a target="_blank" href="https://www.freecodecamp.org/news/learn-rest-apis-javascript-project/#practical-example-how-to-build-a-web-application-with-a-public-rest-api">this freeCodeCamp tutorial</a>. You can download the source code for the project <a target="_blank" href="https://github.com/iamspruce/ip-address-tracker/">here</a>.</p>
<p>If you've followed the tutorial and built the project, or if you have a project you'd like to share, this article is for you. We'll walk you through the steps to host your project on GitHub, making it accessible to the world.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ol>
<li><p><a class="post-section-overview" href="#heading-audience">Audience</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-prerequisite-knowledge">Prerequisite Knowledge</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-getting-started-with-git-and-github">Getting Started With Git and GitHub</a></p>
<ol>
<li><p><a class="post-section-overview" href="#heading-what-is-git">What is Git?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-what-is-github">What is GitHub?</a></p>
</li>
</ol>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-set-up-git-and-github">How to Set Up Git and GitHub</a></p>
<ol>
<li><p><a class="post-section-overview" href="#heading-how-to-install-git-on-windows">How to Install Git on Windows</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-install-git-on-macos">How to Install Git on macOS</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-install-git-on-linux">How to Install Git on Linux</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-create-a-github-account">How to Create a GitHub Account</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-configure-git">How to Configure Git</a></p>
</li>
</ol>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-initialize-a-git-repository">How to Initialize a Git Repository</a></p>
<ol>
<li><p><a class="post-section-overview" href="#heading-step-1-download-and-open-your-project">Step 1: Download and Open Your Project</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-2-open-the-project-in-vs-code">Step 2: Open the Project in VS Code</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-3-open-the-terminal-in-vs-code">Step 3: Open the Terminal in VS Code</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-4-initialize-a-git-repository">Step 4: Initialize a Git Repository</a></p>
</li>
</ol>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-track-changes-with-git">How to Track Changes with Git</a></p>
<ol>
<li><p><a class="post-section-overview" href="#heading-preparing-changes-with-git-add">Preparing Changes with git add</a></p>
<ol>
<li><p><a class="post-section-overview" href="#heading-adding-individual-files">Adding Individual Files</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-adding-all-changes-at-once">Adding All Changes at Once</a></p>
</li>
</ol>
</li>
<li><p><a class="post-section-overview" href="#heading-saving-changes-with-git-commit">Saving Changes with git commit</a></p>
</li>
</ol>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-push-your-project-to-github">How to Push Your Project to GitHub</a></p>
<ol>
<li><p><a class="post-section-overview" href="#heading-step-1-create-a-new-repository-on-github">Step 1: Create a New Repository on GitHub</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-2-link-your-local-repository-to-github">Step 2: Link Your Local Repository to GitHub</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-3-push-your-local-changes-to-github">Step 3: Push Your Local Changes to GitHub</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-4-verify-your-repository-on-github">Step 4: Verify Your Repository on GitHub</a></p>
</li>
</ol>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-host-your-project-on-github-pages">How to Host Your Project on GitHub Pages</a></p>
<ol>
<li><p><a class="post-section-overview" href="#heading-what-are-github-pages">What are GitHub Pages?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-enable-github-pages">How to Enable GitHub Pages</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-get-your-github-pages-url">How to Get Your GitHub Pages URL</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-update-your-github-pages-site">How to Update Your GitHub Pages Site</a></p>
</li>
</ol>
</li>
<li><p><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></p>
</li>
</ol>
<h2 id="heading-audience">Audience</h2>
<p>This guide is for beginner developers who have started learning HTML, CSS, and JavaScript and want to learn how to share their projects using Git and GitHub.</p>
<h2 id="heading-prerequisite-knowledge">Prerequisite Knowledge</h2>
<p>Before diving in, ensure you are familiar with:</p>
<ul>
<li><p>Basic command-line operations.</p>
</li>
<li><p>HTML, CSS, and JavaScript fundamentals.</p>
</li>
<li><p>A text editor like VS Code.</p>
</li>
</ul>
<h2 id="heading-getting-started-with-git-and-github">Getting Started With Git and GitHub</h2>
<p>I am not going to try to bore you with the differences between Git and GitHub. I am sure there are tons of resources in the world wide web already covering that but from a beginner's point of view, here is what they are:</p>
<h3 id="heading-what-is-git">What is Git?</h3>
<p>Git is a tool that helps you keep track of all the changes you make in your project's code. Imagine building a website about cats. If you change the website's title from "Cat Facts" to "All About Cats," Git will remember the change. If you later decide that you prefer "Cat Facts," Git lets you go back to that version easily.</p>
<p>It's like having a record of every edit, addition, and deletion you make to your project, so you can always revisit previous versions and make changes with confidence.</p>
<h3 id="heading-what-is-github">What is GitHub?</h3>
<p>GitHub is like a cloud-based scrapbook for your code. It's an online record where you save every edit, addition, and deletion you make to your project, so you can access it from anywhere and share it with others.</p>
<p>Imagine having a digital filing cabinet where you can store and manage different versions of your website. You can invite friends to see and even help you with your project, making it easy to collaborate. GitHub tracks changes and keeps everything organized, so if something goes wrong, you can always go back to a previous version.</p>
<h2 id="heading-how-to-set-up-git-and-github">How to Set Up Git and GitHub</h2>
<p>Now that we know what Git and GitHub are, let's get them set up on your computer. Follow these step-by-step instructions:</p>
<h3 id="heading-how-to-install-git-on-windows">How to Install Git on Windows</h3>
<p>You can download the Git installer <a target="_blank" href="https://git-scm.com/">here</a>.</p>
<p>Run the installer and follow the setup instructions, keeping the default settings.</p>
<h3 id="heading-how-to-install-git-on-macos">How to Install Git on macOS</h3>
<p>Open the Terminal on your Mac. You can find it in Applications &gt; Utilities or use Spotlight to search for it.</p>
<p>Install Git using Homebrew by copying and pasting the following commands:</p>
<pre><code class="lang-bash">/bin/bash -c <span class="hljs-string">"<span class="hljs-subst">$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)</span>"</span>
brew install git
</code></pre>
<p>Output:</p>
<pre><code class="lang-bash">==&gt; Downloading https://github.com/Homebrew/brew/tarballs/...
==&gt; Installing git
==&gt; Pouring git-2.43.0.mojave.bottle.tar.gz
🍺  /usr/<span class="hljs-built_in">local</span>/Cellar/git/2.30.1: 1,434 files, 43.8MB
</code></pre>
<h3 id="heading-how-to-install-git-on-linux">How to Install Git on Linux</h3>
<p>Open Terminal on your Linux machine. Then use your distribution's package manager to install Git.</p>
<p>For example, on Ubuntu, copy and paste the following commands:</p>
<pre><code class="lang-bash">sudo apt-get update
sudo apt-get install git
</code></pre>
<p>Output:</p>
<pre><code class="lang-plaintext">Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
git-man liberror-perl
Suggested packages:
git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk
gitweb git-mediawiki git-arch git-cvs git-svn git-hg
The following NEW packages will be installed:
git git-man liberror-perl
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 7,841 kB of archives.
After this operation, 43.8 MB of additional disk space will be used.
</code></pre>
<p>To verify the installation, open Terminal (if it's not already open) and type the following command to verify the installation:</p>
<pre><code class="lang-bash">git --version
</code></pre>
<p>Output:</p>
<pre><code class="lang-bash">git version 2.43.0
</code></pre>
<p>You should see the installed Git version displayed.</p>
<h3 id="heading-how-to-create-a-github-account">How to Create a GitHub Account</h3>
<ul>
<li><p>Go to <a target="_blank" href="https://github.com/">GitHub</a> and click on "Sign up."</p>
</li>
<li><p>Follow the instructions to create your account, choose a username and password, and verify your email.</p>
</li>
<li><p>Once your account is set up, customize your profile with a bio, profile picture, and links to your personal website or social media.</p>
</li>
</ul>
<h3 id="heading-how-to-configure-git">How to Configure Git</h3>
<p>Open Terminal and configure Git with the same username and email as your GitHub account:</p>
<pre><code class="lang-bash">git config --global user.name <span class="hljs-string">"Your GitHub Username"</span>
git config --global user.email <span class="hljs-string">"your.email@example.com"</span>
</code></pre>
<p>No output will be displayed, but Git will store your credentials for future use.</p>
<h2 id="heading-how-to-initialize-a-git-repository">How to Initialize a Git Repository</h2>
<p>Now that you have Git and GitHub set up, let's start by initializing Git in a project. You can use any project of your choice or follow along with our example using the "IP Address Tracker" project.</p>
<h3 id="heading-step-1-download-and-open-your-project">Step 1: Download and Open Your Project</h3>
<p>Download the source code for your chosen project or use the "IP Address Tracker" project from <a target="_blank" href="https://github.com/iamspruce/ip-address-tracker/">this link</a>. Extract the downloaded ZIP file to a location on your computer. This will provide a concrete example to demonstrate Git concepts.</p>
<h3 id="heading-step-2-open-the-project-in-vs-code">Step 2: Open the Project in VS Code</h3>
<p>Open Visual Studio Code and click on "File" &gt; "Open Folder" to select the folder where you extracted the project.</p>
<h3 id="heading-step-3-open-the-terminal-in-vs-code">Step 3: Open the Terminal in VS Code</h3>
<p>Click on "Terminal" &gt; "New Terminal" to open the terminal in VS Code, where we'll interact with Git using commands.</p>
<h3 id="heading-step-4-initialize-a-git-repository">Step 4: Initialize a Git Repository</h3>
<p>Initialize a Git repository by running the following command:</p>
<pre><code class="lang-bash">git init
</code></pre>
<p>Output:</p>
<pre><code class="lang-bash">Initialized empty Git repository <span class="hljs-keyword">in</span> /Users/spruceemmanuel/Documents/IP Address Tracker/.git/
</code></pre>
<p>This command creates a new hidden folder called <strong>.git</strong> in your project folder, which tracks changes to our project files. When you run <code>git init</code>, Git sets up the necessary files and directories to start versioning our project. This includes:</p>
<ul>
<li><p>A <strong>.git</strong> folder that stores all the metadata for your repository</p>
</li>
<li><p>A main branch, which is the default branch for your repository</p>
</li>
<li><p>A HEAD pointer, which points to the current branch (in this case, main).</p>
</li>
</ul>
<p>By initializing a Git repository, you're telling Git to start tracking changes to your project files. This allows you to version your code, collaborate with others, and maintain a record of changes.</p>
<h2 id="heading-how-to-track-changes-with-git">How to Track Changes with Git</h2>
<p>Now that we’ve set up Git, it’s ready to keep track of changes in our project.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/08/Screenshot-2024-08-04-at-11.30.49-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>VSCode source control</em></p>
<p>Git notices change in our files, but before we can save these changes, we need to tell Git to do so.</p>
<h3 id="heading-preparing-changes-with-git-add">Preparing Changes with git add</h3>
<p>To get our changes ready to save, we use the <code>git add</code> command. Here’s how it works:</p>
<h4 id="heading-adding-individual-files">Adding Individual Files</h4>
<p>If you want to add specific files, like index.html, script.js, or styles.css, you can use git add followed by the file name. For example:</p>
<pre><code class="lang-bash">git add index.html
</code></pre>
<h4 id="heading-adding-all-changes-at-once">Adding All Changes at Once</h4>
<p>If you want to add all modified files in the project to the staging area, use:</p>
<pre><code class="lang-bash">git add .
</code></pre>
<h3 id="heading-saving-changes-with-git-commit">Saving Changes with git commit</h3>
<p>Once we’ve used git add, we use git commit to save our changes. Here’s how to do it:</p>
<pre><code class="lang-bash">git commit -m <span class="hljs-string">"Describe your changes here"</span>
</code></pre>
<p>Replace "Describe your changes here" with a brief description of what you’ve changed. For example:</p>
<pre><code class="lang-bash">git commit -m <span class="hljs-string">"Update index.html with new content"</span>
</code></pre>
<p>Output:</p>
<pre><code class="lang-bash">[master (root-commit) be9b1cd] Update index.html with new content
3 files changed, 386 insertions(+)
create mode 100644 index.html
create mode 100644 script.js
create mode 100644 styles.css
</code></pre>
<p>By using <code>git add</code> and <code>git commit</code>, you’re instructing Git to track and save specific versions of your project. This helps you manage changes, collaborate with others, and maintain a record of your progress.</p>
<h2 id="heading-how-to-push-your-project-to-github">How to Push Your Project to GitHub</h2>
<p>Now that we have our changes tracked and committed locally, it’s time to upload our project to GitHub so we can share it with the world.</p>
<h3 id="heading-step-1-create-a-new-repository-on-github">Step 1: Create a New Repository on GitHub</h3>
<ul>
<li><p>Go to GitHub and log in to your account.</p>
</li>
<li><p>Click the "+" icon in the upper-right corner and select "New repository."</p>
</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/08/Screenshot-2024-08-04-at-11.36.23-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li><p>Fill out the repository name (for example: "ip-address-tracker"), and add a description if you like.</p>
</li>
<li><p>Choose whether you want the repository to be public or private.</p>
</li>
<li><p>Do not initialize the repository with a <strong>README</strong>, <strong>gitignore</strong>, or license (since we already have a local repository set up).</p>
</li>
<li><p>Click "Create repository."</p>
</li>
</ul>
<h3 id="heading-step-2-link-your-local-repository-to-github">Step 2: Link Your Local Repository to GitHub</h3>
<p>To connect your local repository with the new GitHub repository, you need to add a remote origin. Follow these steps:</p>
<ul>
<li><p>Copy the URL of your new GitHub repository. It should look something like this: https://github.com/yourusername/ip-address-tracker.git</p>
</li>
<li><p>Open Terminal in Visual Studio Code and run the following command:</p>
</li>
</ul>
<pre><code class="lang-bash">git branch -M main
git remote add origin https://github.com/yourusername/ip-address-tracker.git
</code></pre>
<h3 id="heading-step-3-push-your-local-changes-to-github">Step 3: Push Your Local Changes to GitHub</h3>
<p>Now, push your local commits to the GitHub repository with:</p>
<pre><code class="lang-bash">git push -u origin main
</code></pre>
<p>Output:</p>
<pre><code class="lang-bash">Enumerating objects: 8, <span class="hljs-keyword">done</span>.
Counting objects: 100% (8/8), <span class="hljs-keyword">done</span>.
Compressing objects: 100% (4/4), <span class="hljs-keyword">done</span>.
Writing objects: 100% (6/6), 645 bytes | 645.00 KiB/s, <span class="hljs-keyword">done</span>.
Total 6 (delta 2), reused 0 (delta 0)
To https://github.com/yourusername/ip-address-tracker.git
* [new branch]      main -&gt; main
Branch <span class="hljs-string">'main'</span> <span class="hljs-built_in">set</span> up to track remote branch <span class="hljs-string">'main'</span> from <span class="hljs-string">'origin'</span>.
</code></pre>
<h3 id="heading-step-4-verify-your-repository-on-github">Step 4: Verify Your Repository on GitHub</h3>
<p>Go back to your GitHub repository page. You should see all your files and commit history available online.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/08/Screenshot-2024-08-04-at-8.55.48-AM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>A Hosted Repository on GitHub</em></p>
<h2 id="heading-how-to-host-your-project-on-github-pages">How to Host Your Project on GitHub Pages</h2>
<p>Now that your project has been initialized with Git and pushed to GitHub, let’s host it on GitHub Pages. GitHub Pages is a free service that allows you to publish web projects directly from a GitHub repository.</p>
<h3 id="heading-what-are-github-pages">What are GitHub Pages?</h3>
<p>GitHub Pages turns your GitHub repository into a website. It's an easy way to showcase your projects without needing a separate hosting service. You can create static websites directly from your repositories.</p>
<h3 id="heading-how-to-enable-github-pages">How to Enable GitHub Pages</h3>
<ul>
<li><p>Go to your GitHub repository in a web browser.</p>
</li>
<li><p>Click on the "Settings" tab.</p>
</li>
<li><p>Scroll down to the "Pages" section in the left-hand menu.</p>
</li>
<li><p>Under "Source," select the branch you want to publish from (typically main or master), and choose the root folder.</p>
</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/08/Screenshot-2024-08-04-at-11.12.19-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Selecting the branch and root folder for GitHub Pages.</em></p>
<ul>
<li>Click "Save."</li>
</ul>
<h3 id="heading-how-to-get-your-github-pages-url">How to Get Your GitHub Pages URL</h3>
<p>After enabling GitHub Pages, GitHub will provide you with a URL where your site is published. It usually follows this format:</p>
<pre><code class="lang-bash">https://&lt;username&gt;.github.io/&lt;repository-name&gt;
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/08/Screenshot-2024-08-04-at-11.19.05-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>The URL where your GitHub Pages site is published.</em></p>
<p>Open your browser and paste the URL to see your live website.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/08/Screenshot-2024-08-04-at-10.56.40-PM-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Viewing the live website on GitHub Pages.</em></p>
<h3 id="heading-how-to-update-your-github-pages-site">How to Update Your GitHub Pages Site</h3>
<p>Every time you push changes to the selected branch in your repository, GitHub Pages will automatically update your live site. Here’s a quick reminder on how to push changes:</p>
<ul>
<li><p>Make changes to your project files.</p>
</li>
<li><p>Add and commit your changes:</p>
</li>
</ul>
<pre><code class="lang-bash">git add .
git commit -m <span class="hljs-string">"Your commit message"</span>
</code></pre>
<ul>
<li>Push the changes to GitHub:</li>
</ul>
<pre><code class="lang-bash">git push origin main
</code></pre>
<p>With these steps, you’ve successfully hosted your project on GitHub Pages. Congratulations! Your project is now live and accessible to the world.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Just a few years ago, I was in your shoes—excited about building my first website but unsure how to share it with the world. Today, you’ve not only learned what Git and GitHub are but also how to use them to host your very own project.</p>
<p>Imagine your excitement when your project goes live, and you can share it with friends, family, and the global community. You've now set up Git, created a GitHub account, initialized a Git repository, and hosted your project on GitHub Pages. Each step has brought you closer to becoming a more confident and capable developer.</p>
<p>This is just the beginning. Git and GitHub have many more features for you to explore. As you continue building and sharing projects, you’ll discover new ways to collaborate and improve your workflow.</p>
<p>Keep experimenting, keep learning, and most importantly, keep coding. The world is waiting to see what you create next!</p>
<p>If you have any questions, feel free to find me on Twitter at <a target="_blank" href="https://twitter.com/sprucekhalifa">@sprucekhalifa</a>, and don’t forget to follow me for more tips and updates. Happy coding!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Deploy Your Node.js App on Azure ]]>
                </title>
                <description>
                    <![CDATA[ The advent of cloud computing marked a turning point in the field of technology. It provides easier access for users across the globe to web and mobile applications and services.  Modern-day computing services also provide a wide range of features wh... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-deploy-node-js-app-on-azure/</link>
                <guid isPermaLink="false">66bb58c75a83db22bea9843b</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ node ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Oluwatobi ]]>
                </dc:creator>
                <pubDate>Wed, 17 Jul 2024 11:56:43 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/07/awsP.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The advent of cloud computing marked a turning point in the field of technology. It provides easier access for users across the globe to web and mobile applications and services. </p>
<p>Modern-day computing services also provide a wide range of features which make web apps easier to use and more efficient. So it's important for developers to have a basic understanding of how the cloud works.</p>
<p>This article is a beginner's guide to deploying backend applications to the cloud. We'll use the Azure platform as our cloud infrastructure and Node.js/Express for the backend web application. Before we go on, here are a few requirements:</p>
<ul>
<li>Basic understanding of cloud computing (you can check out <a target="_blank" href="https://dev.to/oluwatobi2001/introduction-to-cloud-computing-the-models-benefits-risks-implementation-and-popular-tools-2loh">this article</a> to learn more about that).</li>
<li>Knowledge of JavaScript.</li>
<li>VS Code.</li>
</ul>
<p>With that, let's get started.</p>
<h2 id="heading-introduction-to-azure">Introduction to Azure</h2>
<p>Azure is a cloud computing platform developed by Microsoft that acts as a server for deploying and hosting web applications, databases, file storage, and so on. </p>
<p>Compared to other cloud computing services, it is quite beginner-friendly and has an actively growing user base. Let’s explore the Azure portal.</p>
<h2 id="heading-how-to-set-up-azure-account">How to Set Up Azure Account</h2>
<p>Signing up on the Azure platform is the first step to hosting your application.   First, navigate to <a target="_blank" href="https://azure.microsoft.com/en-us/get-started/azure-portal">the website</a> and complete the signup process.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/image-36.png" alt="Image" width="600" height="400" loading="lazy">
<em>Azure sign in page</em></p>
<p>After signing up, you'll have access to the management console of the Azure application where all our activities can be carried out.</p>
<p>Before we go on, here are some of the services we'll be getting familiar with on this platform.</p>
<ul>
<li>Azure Resource groups</li>
<li>Azure app services</li>
<li>Storage accounts</li>
<li>SQL databases</li>
<li>Virtual networks</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/serc3.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>Azure services</em></p>
<p>Congratulations on successfully creating your Azure account.</p>
<h2 id="heading-deployment-options-on-azure">Deployment Options on Azure</h2>
<p>As a cloud computing platform, Azure boasts of its wide versatility. Depending on your skill level or preference, you can deploy web applications to Azure via the following options:</p>
<ul>
<li>Azure CLI</li>
<li>Azure Virtual machines</li>
<li>Azure Functions</li>
<li>Azure Kubernetes Service</li>
<li>Azure Storage.</li>
<li>Azure DevOps</li>
<li>Azure portal service</li>
</ul>
<p>We'll utilize the Azure portal service for this tutorial and use its VS Code integration to deploy a simple Node.js application to the Azure cloud.</p>
<h2 id="heading-how-to-set-up-the-backend-application">How to Set Up the Backend Application</h2>
<p>We'll create our web application using Node.js via the command line and Visual Studio Code.</p>
<p>Firstly, navigate to the folder where your app will be created and initialize a Node project by executing <code>npm init</code></p>
<p>Next, initialize the app by installing the <code>Express</code> framework. This can be done via <code>npm i express</code>. </p>
<p>Go on and paste the sample code for this tutorial:</p>
<pre><code><span class="hljs-keyword">const</span> express = <span class="hljs-built_in">require</span>(<span class="hljs-string">"express"</span>);
<span class="hljs-keyword">const</span> app = express();

app.use(express.json());

app.get(<span class="hljs-string">"/"</span>, <span class="hljs-function">(<span class="hljs-params">req, res</span>) =&gt;</span> {
    res.send(<span class="hljs-string">"Hello, World"</span>);
});

app.listen(process.env.PORT || <span class="hljs-number">5000</span>, <span class="hljs-function">() =&gt;</span> {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Server is running on port "</span> + (process.env.PORT || <span class="hljs-number">5000</span>));
});
</code></pre><p>The code above outputs <code>Hello World</code> whenever it is executed.</p>
<h2 id="heading-application-deployment">Application Deployment</h2>
<p>The backend code we wrote in the preceding paragraph will be deployed to Azure via the use of Azure’s VS Code extension.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/webVs.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>VS Code homepage</em></p>
<p>Navigate to the Extensions tab, search for Azure App Services and install the extension. On successful installation, an Azure widget will appear on your taskbar where you can sign in to the Azure cloud.  </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/azure-app-service.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>Extensions marketplace</em></p>
<p>Subsequently, we'll be creating a cloud-based web application in which our Node.js code will later be deployed.</p>
<p>On the Azure resources tab, clicking the <code>plus</code> icon will display a drop-down menu where various development options can be seen. We'll be clicking on the Azure app services option.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/res-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Azure drop down menu</em></p>
<p>After clicking that, a prompt will pop up asking for a unique name for the cloud application. In my case, I went with newApp777.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/newa7.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>creating a web application</em></p>
<p>However, you can use any other name you so wish. Subsequently, you will need to select the backend language of your choice. Any version of Node.js will be compatible with our application.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/newStack.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>web stacks available</em></p>
<p>Also, the F1 service option will be used for this tutorial. However, you can pick anyone you so desire.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/newTier.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>Various Azure tiers</em></p>
<p>On successful completion, your application will be created on the Azure portal.</p>
<p>Now to the crux of the matter. Let's install our Node.js code on this web application. </p>
<p>We'll click on the code folder which provides us with options to automatically deploy our code to an Azure web app service.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/image-35.png" alt="Image" width="600" height="400" loading="lazy">
<em>Deployment dropdown menu</em></p>
<p>As soon as this is done, the list of the cloud servers on your Azure account will be shown. You can then select the new app we just created.  </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/sear.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>app deployment</em></p>
<p>Your backend code should then be deployed on the NewApp cloud server we created. On successful completion, you'll receive a success message with a link to your cloud application.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/pro.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>command prompt interface</em></p>
<p>Congratulations, you have successfully hosted your first web application. Navigate <a target="_blank" href="https://newapp777.azurewebsites.net/">here</a> to see the hosted application.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/wevpage.PNG" alt="Azure app" width="600" height="400" loading="lazy">
<em>The application webpage</em></p>
<h2 id="heading-additional-information">Additional Information</h2>
<p>So far, we have covered the basics of deploying an application via the use of VS code extensions on Azure portal services. As you progress in the field of cloud computing, other interesting fields can also be explored such as:</p>
<ul>
<li>App monitoring with Azure Monitor.</li>
<li>Azure app networking essentials.</li>
<li>Azure MySQL database integration.</li>
<li>Node JS serverless functions deployment.</li>
</ul>
<p>You can also interact with me on my blog and check out my other articles <a target="_blank" href="https://linktr.ee/tobilyn77">here</a>. Till next time, keep on coding!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Deploy a Django App on Render ]]>
                </title>
                <description>
                    <![CDATA[ Render is a hosting platform that helps you deploy your apps easily. Whether you're building web servers, static websites, cron jobs, or containers, this tool can help you streamline the process. If you're a developer early in your career and you nee... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/deploying-a-django-app-to-render/</link>
                <guid isPermaLink="false">66c4c637d788a9c53d88d2e0</guid>
                
                    <category>
                        <![CDATA[ Django ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Sophia Iroegbu ]]>
                </dc:creator>
                <pubDate>Wed, 09 Aug 2023 14:13:39 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/08/Blog-Banner---Template--6-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Render is a hosting platform that helps you deploy your apps easily. Whether you're building web servers, static websites, cron jobs, or containers, this tool can help you streamline the process.</p>
<p>If you're a developer early in your career and you need to build a compelling CV, résumé, or portfolio, Render provides a free tier that offers 1GB of storage capacity. </p>
<p>In this guide, we'll explore how to deploy a Django app on the Render platform. The project we create will help you showcase your coding skills and projects effectively while learning about deployment.</p>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>To follow along with this guide, you'll need to have a few things set up:</p>
<ul>
<li>An account on the <a target="_blank" href="https://render.com/">Render</a> platform</li>
<li>A <a target="_blank" href="https://www.freecodecamp.org/news/introduction-to-git-and-github/">Git</a> account</li>
<li><a target="_blank" href="https://www.postgresql.org/docs/">PostgreSQL</a> installed </li>
<li>A <a target="_blank" href="https://github.com/">GitHub</a> account</li>
</ul>
<p>Now let's learn how to deploy a Django web server for free. 🚀</p>
<h2 id="heading-how-to-set-up-a-postgresql-database">How to Set Up a PostgreSQL Database</h2>
<p>First, head over to your Render dashboard and create a PostgreSQL database. Click the <strong>New +</strong> button, hover over PostgreSQL, and click it. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/SmOWvHI.png" alt="Image" width="600" height="400" loading="lazy">
<em>Render Dashboard – creating a PostgreSQL database</em></p>
<p>Next, define your database settings by giving your database instance a name. You can choose to either let Render to define a name for a database and a user or define it yourself. </p>
<p>This guide is for beginners, we'll only define the instance name.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/Screenshot-2023-07-28-070509.png" alt="Image" width="600" height="400" loading="lazy">
<em>Creating a new PostgreSQL database</em></p>
<p>Select the free tier and click on <strong>Create Database.</strong> </p>
<p>Note: Every free database created on Render expires 90 days after creation. So just take note of this and upgrade if it's an important project. You can see the pricing <a target="_blank" href="https://render.com/pricing">here</a>. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/V4O1Sin.png" alt="Image" width="600" height="400" loading="lazy">
<em>Creating a new PostgreSQL database</em></p>
<p>Once the status on your database shows <strong>Available</strong>, it means the database has been successfully created and is ready to use. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/Utirlzn.png" alt="Image" width="600" height="400" loading="lazy">
<em>Checking the status of a newly created PostgreSQL DB</em></p>
<p>Scroll down this page to see your database settings. You'll use these settings to set up your Django app. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/GKfYcUX.png" alt="Image" width="600" height="400" loading="lazy">
<em>Database information</em></p>
<p>Next, access control lets you choose an IP address to access your database. </p>
<p>Once your database is created, it comes with a pre-defined access control route that allows you to access it from anywhere in the world using a single (1) IP address. Although, you can't set another route since you are using a free plan on Render. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/Screenshot-2023-07-28-072323.png" alt="Image" width="600" height="400" loading="lazy">
<em>PostgreSQL access control information</em></p>
<p>You can choose to change this or leave it as the default. </p>
<p>Now that we've created a database, let's set it up on a Django project.</p>
<h2 id="heading-how-to-connect-your-database">How to Connect Your Database</h2>
<p>Once the database is set up, you need to connect it to your Django project in the <code>settings.py</code> file. </p>
<p>Head over to your codebase and connect it. </p>
<p>First, Install dj-database-url </p>
<pre><code class="lang-python">pip install dj-database-url
</code></pre>
<p>There are different ways to connect your database to your app's project. This guide uses the external connection URL. </p>
<p>Head over to your database settings on Render and copy the <strong>External Database URL</strong>. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/dJqwIy4.png" alt="Image" width="600" height="400" loading="lazy">
<em>Getting External DB URL</em></p>
<p>Next, import <a target="_blank" href="https://pypi.org/project/dj-database-url/"><em>dj-database-url</em></a> in your <code>settings.py</code> and define the database URL (from Render) as your database. </p>
<p>Note: It is always wise to add sensitive information to an .env file for security reasons. </p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> dj-database-url
<span class="hljs-keyword">import</span> os

DATABASES = {
    <span class="hljs-string">"default"</span>: dj_database_url.parse(os.environ.get(<span class="hljs-string">"DATABASE_URL"</span>))
}
</code></pre>
<p>Next, migrate your tables to your new database to ensure the connection was successful. </p>
<p>If you haven't made any migrations to any db.sqlite locally, ensure you make migrations first or you won't create tables when you run <code>python manage.py migrate</code>. </p>
<pre><code class="lang-python"><span class="hljs-comment"># To make migrations if this is your first time connecting to a database </span>
python manage.py makemigrations

<span class="hljs-comment">#To migrate tables set on your migrations folders</span>
python manage.py migrate
</code></pre>
<p>If the connection was successful and you migrate all your tables, your terminal output should look like this:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/nXVd604.png" alt="Image" width="600" height="400" loading="lazy">
<em>Successful migration</em></p>
<p>You are now one step away from deploying your Django project! 🎉</p>
<p>Don't forget to push your codebase to a Git repo with meaningful commits. </p>
<h2 id="heading-how-to-create-a-web-service">How to Create A Web Service</h2>
<p>This is the last step to getting your project live.</p>
<p>Head over to your Render dashboard. Click <strong>New +</strong> and Select <strong>Web Service</strong>. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/wbse.png" alt="Image" width="600" height="400" loading="lazy">
<em>Creating a new web service</em></p>
<p>Connect your GitHub if you haven't already. It should look like this once it's connected:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/MMk3GWX.png" alt="Image" width="600" height="400" loading="lazy">
<em>Connecting your Git to render platform</em></p>
<p>Search for the repo you want to deploy and click the <strong>Connect</strong> button. It should work seamlessly. </p>
<p>Then, define your repo's settings. Give your app a name and ensure you are connecting to the right branch. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/deploy.png" alt="Image" width="600" height="400" loading="lazy">
<em>Setting Django web server</em></p>
<p>Install gunicorn and change your requirements.txt in your Django project. By performing <strong>pip freeze &gt; requirements.txt</strong>, you can update installed packages in your requirements.txt. This automatically changes your project's list of required files.</p>
<p>Gunicorn is a lightweight Python web server that acts as a gateway between a web application and the internet. It is designed for deployment since it manages incoming web requests effectively.</p>
<p>Then, push your changes to Git. Remember, you connected Git to your web service, so Render monitors the repo and auto deploys when it detects any changes. </p>
<pre><code class="lang-python">pip install gunicorn

pip freeze &gt; requirements.txt <span class="hljs-comment"># To update your requirements.txt file</span>
</code></pre>
<p>Ensure you add your Render web service to <strong>ALLOWED_HOSTS</strong> in your settings.py. </p>
<p>Next, ensure that you set the right <code>requirements.txt</code> as you can see in the image below. Also, make sure you use the right Python runtime and define your project's gunicorn settings on Render platform.</p>
<p>Once done, scroll down and select <strong>Create Web Service</strong>. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/req-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Creating a web service</em></p>
<p>Go back to the Render Dashboard and click on the Deployed Web Service to view your live link.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/final.png" alt="Image" width="600" height="400" loading="lazy">
<em>Deployed web service and database</em></p>
<p>That's it! You've deployed your first Django app on a free platform. Enjoy your web server for the next 90 days. 😎</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>To sum up, deploying a Django app/server or any server on Render is easy and efficient. </p>
<p>By leveraging Render's features like continuous integration and built-in monitoring, developers can focus more on building the app and its features rather than stressing over the app's infrastructure and management. </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Point your Domain to an S3 Website Bucket ]]>
                </title>
                <description>
                    <![CDATA[ By Clark Jason Ngo If you're hosting a static website in an S3 bucket and it's your first time buying a domain name, this simple guide is for you. Summary - What You Need Amazon S3 Have an S3 bucket with the same name as your domain name Upload your... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/cjn-how-to-point-your-domain-to-s3-website-bucket/</link>
                <guid isPermaLink="false">66d45e103a8352b6c5a2aa1b</guid>
                
                    <category>
                        <![CDATA[ dns ]]>
                    </category>
                
                    <category>
                        <![CDATA[ S3 ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                    <category>
                        <![CDATA[ website development, ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Sat, 21 Mar 2020 00:08:34 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/03/domain_name_point_to_s3_bucket.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Clark Jason Ngo</p>
<p>If you're hosting a static website in an S3 bucket and it's your first time buying a domain name, this simple guide is for you.</p>
<h2 id="heading-summary-what-you-need">Summary - What You Need</h2>
<h3 id="heading-amazon-s3">Amazon S3</h3>
<ul>
<li>Have an S3 bucket with the same name as your domain name</li>
<li>Upload your website's code</li>
<li>Allow public access</li>
<li>Add a policy to enable S3 GetObject</li>
<li>Enable static website hosting</li>
</ul>
<h3 id="heading-domain-name-provider">Domain Name provider</h3>
<ul>
<li>In your domain name's DNS Zone settings, delete all <strong>A</strong> records</li>
<li>In DNS Zone settings, add <em>www</em> to <strong>subdomain</strong> and the S3 endpoint in hostname for <strong>CNAME</strong> records</li>
</ul>
<p>Let's go through these steps one by one.</p>
<h2 id="heading-step-1-create-an-s3-bucket">Step 1: Create an S3 bucket</h2>
<p>Create an S3 bucket to host your files for your website</p>
<p>First you need to create a bucket for your website. The name for your bucket must be the same as your domain name. Let's say we bought the domain name <strong>www.clarkngo.net</strong>. Then my S3 bucket's name should be <strong>www.clarkngo.net</strong> as well. </p>
<p>After configuration, my endpoint should look similar to this:</p>
<p>http://www.clarkngo.net.s3-website-us-west-2.amazonaws.com</p>
<p>Go to your AWS console and login. Choose S3.</p>
<ol>
<li>Click <strong>Buckets</strong></li>
<li>Click <strong>Create bucket</strong></li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-119.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="3">
<li><p>Add your domain name in the <strong>bucket name</strong></p>
</li>
<li><p>You may choose any <strong>Region</strong></p>
</li>
</ol>
<h3 id="heading-creating-the-s3-bucket-and-general-configuration">Creating the S3 bucket and general configuration</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-118.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Follow the checkboxes below and click <strong>Create Bucket</strong>.</p>
<p>Only tick the following:</p>
<ul>
<li><strong>Block public access to bucket and objects granted through <em>new</em> access control lists (ACLs)</strong></li>
<li><strong>Block public access to bucket and objects granted through <em>any</em> access control lists (ACLs)</strong></li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-120.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-uploading-files-to-the-s3-bucket">Uploading files to the S3 Bucket</h3>
<ol>
<li>Click <strong>Overview</strong> and <strong>Upload</strong>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-121.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="2">
<li>Upload your website files in <strong>Select Files</strong></li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-122.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="3">
<li><p>For <strong>Set permissions</strong>, hit <strong>Next</strong>.</p>
</li>
<li><p>For <strong>Set properties</strong>, hit <strong>Next</strong>. (The default is Standard S3.)</p>
</li>
<li><p>For <strong>Review</strong>, hit <strong>Upload</strong>.</p>
</li>
</ol>
<h3 id="heading-editing-the-bucket-policy">Editing the Bucket Policy</h3>
<ol>
<li>Click <strong>Permissions</strong>, then <strong>Bucket Policy</strong>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-123.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="2">
<li>Add the policy. (Note: For your website you'll change <strong>arn:aws::s3:::www.clarkngo.net/*</strong>)</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-124.png" alt="Image" width="600" height="400" loading="lazy"></p>
<pre><code>{
    <span class="hljs-string">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
    <span class="hljs-string">"Id"</span>: <span class="hljs-string">"Policy1548223592786"</span>,
    <span class="hljs-string">"Statement"</span>: [
        {
            <span class="hljs-string">"Sid"</span>: <span class="hljs-string">"Stmt1548223591553"</span>,
            <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
            <span class="hljs-string">"Principal"</span>: <span class="hljs-string">"*"</span>,
            <span class="hljs-string">"Action"</span>: <span class="hljs-string">"s3:GetObject"</span>,
            <span class="hljs-string">"Resource"</span>: <span class="hljs-string">"arn:aws:s3:::www.clarkngo.net/*"</span>
        }
    ]
}
</code></pre><ol start="3">
<li>Hit <strong>Save</strong>.</li>
</ol>
<h3 id="heading-static-website-hosting">Static website hosting</h3>
<ol>
<li>Click <strong>Properties</strong>, then <strong>Static website hosting</strong>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-125.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="2">
<li><p>Choose <strong>Use this bucket to host a website</strong>.</p>
</li>
<li><p>For Index document, type <em>index.html</em>.</p>
</li>
<li><p>For Error document, type <em>index.html</em>.</p>
</li>
<li><p>Hit <strong>Save</strong>.</p>
</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-126.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-step-2-add-the-s3-endpoint-to-your-domain">Step 2: Add the S3 Endpoint to your Domain</h2>
<h3 id="heading-editing-your-dns-zone">Editing your DNS Zone</h3>
<ol>
<li>Login to your domain provider.</li>
<li>In this example, choose <strong>Name Servers/DNS</strong>, then <strong>Modify DNS Zone</strong> (or the equivalent).</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-127.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="3">
<li>Remove all <strong>A</strong> records in your domain. Usually it will have a default IP address for a 404 Not Found page.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-128.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="4">
<li><p>Add a <strong>CNAME</strong> to point to the S3 Bucket:</p>
</li>
<li><p>add <strong>www</strong> for the Subdomain.</p>
</li>
<li>add <strong>www.clarkngo.net.s3-website-us-west-2.amazonaws.com</strong> (the S3 Endpoint) to the Hostname.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-129.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>And you're done! Note that it might take a while for your new settings take effect.</p>
<p>Connect with me in LinkedIn <a target="_blank" href="https://www.linkedin.com/in/clarkngo/">here</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/03/image-133.png" alt="Image" width="600" height="400" loading="lazy"></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to deploy a static website for free in just 3 minutes straight from your Google Drive, using Fast.io ]]>
                </title>
                <description>
                    <![CDATA[ In this article, I'll show you how to deploy a static website for free in only 3 minutes, using a cloud storage service like Google Drive or Dropbox. And no - fast.io didn't pay me or freeCodeCamp to create this article. We don't have any relationshi... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-deploy-a-static-website-for-free-in-only-3-minutes-with-google-drive/</link>
                <guid isPermaLink="false">66bb92053e3fa59ecfecb876</guid>
                
                    <category>
                        <![CDATA[ CSS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ HTML ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Gaël Thomas ]]>
                </dc:creator>
                <pubDate>Wed, 15 Jan 2020 12:24:22 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/01/how-to-deploy-a-static-website-for-free-in-only-3-minutes-with-google-drive-1.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this article, I'll show you how to deploy a static website for free in only 3 minutes, using a cloud storage service like Google Drive or Dropbox.</p>
<p>And no - fast.io didn't pay me or freeCodeCamp to create this article. We don't have any relationship with them. I'm just writing about this because I found their tool to be really exciting and useful for quickly hosting static websites for free.</p>
<p><em>Note: The information in this tutorial is now outdated, but this article stays here for posterity. <a target="_blank" href="https://www.freecodecamp.org/news/search?query=static%20website">Here are some helpful articles you may like</a> on a similar topic.</em></p>
<h2 id="heading-what-is-fastio">What is Fast.io?</h2>
<p>Fast.io is a solution created by Mediafire to simplify how the web works. In a few words, their goal is to make your life easier by making the web more accessible and manageable.</p>
<p>It was launched at the end of 2019, so I'm sharing it with you now.</p>
<h2 id="heading-how-it-works">How it works</h2>
<p>When you use Fast.io, you will be able to connect to your cloud (Google Drive, DropBox, etc.), choose a website name, and deploy your content all in a few clicks.</p>
<p>If your content is ready, only 3 minutes are required to put your content online and make it accessible to everyone.</p>
<p>Once your website is online, you can configure it, add a custom domain name, and connect Google Analytics so you know how many people you are reaching.</p>
<p>I haven't mentioned this yet, but the service automatically updates your website once you modify the source files. For example, if you are using Google Drive to share your content, once you change something in your HTML page, it will be updated.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-how-it-works.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - <a target="_blank" href="https://fast.io/">How it works</a></em></p>
<h3 id="heading-available-storage-providers">Available storage providers</h3>
<p>Here's a list of available storage providers if I were to publish my website today:</p>
<ul>
<li>GitHub</li>
<li>Dropbox</li>
<li>Google Drive</li>
<li>Box</li>
<li>Mediafire</li>
<li>OneDrive</li>
</ul>
<p>As you can imagine, this list is going to grow as new services are added. But even now, you have many possibilities to host your static website.</p>
<h2 id="heading-competitors">Competitors</h2>
<p>There are already a number of different companies who allow you to quickly get a static website online. The most famous solutions are GitHub Pages, Heroku, and Netlify.</p>
<p>I'm not necessarily saying that Fast.io is the best one, but I like how simple it is to deploy a basic website.</p>
<p>Quick note: if you want to deploy something more complex – like a Python Flask website – you can't do it with Fast.io. In this case, I highly recommend using Heroku.</p>
<p>As I told you, I'm going to be transparent with you. Fast.io an excellent service for certain tasks.</p>
<h2 id="heading-what-is-a-static-website">What is a static website?</h2>
<p>Before showing you how to deploy your website, I think it's essential to define what a static website is and what the differences are from a dynamic site.</p>
<p>A static website contains web pages with fixed content. The content of your page is in HTML, and all users see the same thing.</p>
<p>For example, you can use this type of site when you want to do a landing page for your website (a basic page with information about your product).</p>
<p>The main difference between that and a dynamic website is, of course… the dynamic part!</p>
<p>A dynamic website uses a server technology to build the page when a user requests the website.</p>
<p>For example, you can use this type of site for your blog. Every time you add a new article to your database, the website will display it.</p>
<h2 id="heading-its-time-to-deploy-your-website">It’s time to deploy your website</h2>
<p>Are you ready to share your page with everyone? Let’s do it!</p>
<p>In this part, I will show you how to put your website online in a few clicks. I’m going to use a basic HTML page, but once you understand how Fast.io works you are free to modify everything.</p>
<h3 id="heading-1-create-a-indexhtml-file">1) Create a index.html file</h3>
<p>You need to create an index.html file with your HTML code inside. I recommend that you to start with something simple because you can always update it later.</p>
<p>Save the file on your computer.</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>My Static Website<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>My Static Website<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>
      Hello, I'm online, and everyone can see me!
    <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<h3 id="heading-2-open-the-fastio-homepage">2) Open the Fast.io homepage</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-homepage.png" alt="Image" width="600" height="400" loading="lazy">
<em><a target="_blank" href="https://fast.io">Fast.io</a> homepage</em></p>
<p>All you need to do to start with Fast.io is open the website. Once you've done that, click on <strong>"Sign up now - it's free!"</strong>.</p>
<h3 id="heading-3-configure-google-drive">3) Configure Google Drive</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-storage-provider.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Storage provider</em></p>
<p>This page appears after step 2 and allows you to select a storage provider. Select <strong>"Google Drive"</strong>.</p>
<p>If you want to create a website with another provider, you can do that later by adding it through your account page.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-connect-google-drive.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Connect Google Drive</em></p>
<p>Fast.io needs access to your Google Drive account to work. They will create a "Fast.io" folder to contains your website(s). Click on <strong>"Connect Google Drive Now"</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-select-google-account.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Select your Google account</em></p>
<p>You need to <strong>select your Google account</strong> to link it with Fast.io.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/01/fast-io-allow-google.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Allow Fast.io to access Google Drive</em></p>
<p>You need to <strong>allow Fast.io to access your Google account</strong> to link it correctly.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-create-account.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Create your account</em></p>
<p>Your account is now ready, so just choose a password and then <strong>click on "Create Account"</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-welcome.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Welcome page</em></p>
<p>When your account is ready, a "Welcome to Fast!" page will appear. <strong>Click on "Let's begin!"</strong>.</p>
<h3 id="heading-4-create-your-website">4) Create your website</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-add-new-website.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Dashboard</em></p>
<p>You are ready to create your website and share it with everyone! <strong>Click on "Add New Site"</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-website-name.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Choose a website name</em></p>
<p><strong>Choose your website name and type it</strong> in the input box. When you've finished, <strong>click on "Next"</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-select-website-type.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Choose a website type</em></p>
<p>Fast.io allows you to create three website types: a File Sharing website, a Web Page, or a Files Browser website.</p>
<p>In our case, we will <strong>select "Web Pages"</strong> because we want to host an HTML web page.</p>
<p>If later you want to create a website to share some documents, you have to go back to your dashboard, create a new one, and select File Downloads.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-select-google-drive.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Choose a storage provider for your website</em></p>
<p>Once you clicked on "Web Pages", you need to select your storage provider. <strong>Click on "Google Drive"</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-select-url.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Choose your website URL</em></p>
<p><strong>Choose your website URL and type it</strong> in the input box. When you've finished, <strong>click on "Create Site"</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-success.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Successfully created website</em></p>
<p>You did it! Your website is online and available at the URL you chose. In my case, you can find my site on <a target="_blank" href="https://mygoogledrivewebsite.imfast.io">mygoogledrivewebsite.imfast.io</a></p>
<h3 id="heading-5-upload-your-indexhtml">5) Upload your index.html</h3>
<p>If you open your website, you may notice an error because you didn't upload your index.html file on your Google Drive.</p>
<p>Here are two ways to do that:</p>
<ul>
<li><strong>Open your Google Drive and search for the Fast.io folder</strong>, then the folder of your website (in my case, "mygoogledrivewebsite.imfast.io").</li>
<li>On the step 4 success page, <strong>click on "See your Google Drive"</strong>.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-google-drive-upload.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Google Drive before upload</em></p>
<p>Once you've done that, <strong>right-click with your mouse and select "Upload files"</strong>. A new window will open, <strong>find your "index.html" file - select it</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-google-drive.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Google Drive after upload</em></p>
<p>Wait for a little bit before the change appears on your website.</p>
<h3 id="heading-6-celebrate">6) Celebrate!</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/07/fast-io-website-demo.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fast.io - Website demo</em></p>
<p>Spread the word to all your friends! Your website is live and everyone can see it!</p>
<p> ? <a target="_blank" href="https://ctt.ac/Me7Uk">Share it on Twitter by clicking here!</a> ?</p>
<h3 id="heading-7-bonus">7) Bonus</h3>
<p>If you are curious and want to configure everything, you can go back to your dashboard and click on your website.</p>
<p>You will be able to link your website to Google Analytics (visitors statistics), change your domain name (for example, mywebsite.com), and a lot more!</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>What do you think of this new service? Did you find it fast and easy?</p>
<p>Feel free to share this article if you liked it.</p>
<p>If you want more content like this, you can <a target="_blank" href="https://twitter.com/gaelgthomas/">follow me on Twitter</a>, where I tweet about web development, self-improvement, and my journey as a full stack developer!</p>
<p>### </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Host your Static Website with AWS - A Beginner's Guide ]]>
                </title>
                <description>
                    <![CDATA[ When I created my first portfolio last year, I based it on what I had learned from freeCodeCamp (HTML, CSS and a little JavaScript). At that point, I had only viewed my portfolio on localhost by viewing the files on my local computer. I didn’t know a... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/a-beginners-guide-on-how-to-host-a-static-site-with-aws/</link>
                <guid isPermaLink="false">66d4608a47a8245f78752a99</guid>
                
                    <category>
                        <![CDATA[ AWS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ dns ]]>
                    </category>
                
                    <category>
                        <![CDATA[ SSL ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Phoebe Voong-Fadel ]]>
                </dc:creator>
                <pubDate>Thu, 08 Aug 2019 11:48:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2019/08/undraw_blogging_vpvv.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>When I created my first <a target="_blank" href="https://thecodinghamster.com/">portfolio</a> last year, I based it on what I had learned from <a target="_blank" href="https://www.freecodecamp.org/">freeCodeCamp</a> (HTML, CSS and a little JavaScript).</p>
<p>At that point, I had only viewed my portfolio on localhost by viewing the files on my local computer. I didn’t know anything about how to host a website online.</p>
<p>Learning how to host my first website wasn’t easy but it was a great learning experience. If you're an aspiring web developer or just interested in launching your own static website, then I hope you will find this guide useful.</p>
<h4 id="heading-who-is-this-guide-for"><strong>Who is this guide for?</strong></h4>
<p>This guide is aimed at <strong>complete beginners</strong> who want to host a static website (a site with fixed content). I will provide a how-to-guide for the following:</p>
<ol>
<li><p>How to buy a domain.</p>
</li>
<li><p>How to configure your domain for an external hosting provider.</p>
</li>
<li><p>How to host your website with Amazon Web Services (AWS).</p>
</li>
<li><p>How to make your website secure (SSL certification) using Amazon Certification Manager.</p>
</li>
</ol>
<p>There might be some terminology that’s new to you. Please go ahead and look up terms that are not familiar. I’ve put in useful links and explanations where I thought appropriate.</p>
<h4 id="heading-what-is-a-domain-name-and-dns-domain-name-system"><strong>What is a domain name and DNS (Domain Name System)?</strong></h4>
<p>A domain name is your website address. For example thecodinghamster.com. But for a computer, a domain name is actually a series of numbers (an IP address). An IP address looks like this: 123.321.0.1</p>
<p>It’s not easy for us to remember a long string of numbers. So your computer refers to a <strong>DNS</strong> to translate a text based website address into an IP address which it can then understand. A DNS is like a directory.</p>
<p>I watched this great video which explains domain name, DNS and how this works in under five minutes. Please watch the first five minutes of the video if you're interested:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/e2xLV7pCOLI" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<h3 id="heading-where-can-you-buy-your-domain-name">Where can you buy your domain name?</h3>
<p>You can buy a domain name from a domain name registrar. Prices start from a few dollars. Your domain name is unique. Each domain name registrar offers different levels of services/support. But you can register your domain with any registrar.</p>
<h4 id="heading-what-is-a-hosting-provider"><strong>What is a hosting provider?</strong></h4>
<blockquote>
<p>“An <a target="_blank" href="https://en.wikipedia.org/wiki/Internet_hosting_service">Internet hosting service</a> is a service that runs Internet servers, allowing organizations and individuals to serve content to the Internet. There are various levels of service and various kinds of services offered.”</p>
</blockquote>
<p>When I was looking for a hosting provider for my website, I explored different options. The prices ranged from £2.00 — £5.00 per month with various storage options from 0.5GB to 10GB. The prices seemed reasonable but all I wanted to do was host a static website. It had a few images, HTML, CSS and JavaScript files. No dynamic content.</p>
<h4 id="heading-why-aws"><strong>Why AWS?</strong></h4>
<p>After some further research, I found AWS. AWS offers a <a target="_blank" href="https://aws.amazon.com/free/?nc2=h_ql_pr">free tier option</a>. Essentially, you get lots of free products. Some of them expire after 12 months and others are free in perpetuity. The only cost that you will incur for hosting a static website is the cost of setting up a hosted zone. This cost $0.50 per month. So I went with AWS and set up my account.</p>
<p>The great thing about AWS is the price and it’s a reliable hosting provider. But one thing to bear in mind is that you’re reliant on their documentation. As I started reading about what services AWS offered, it quickly became confusing! I used the official AWS <a target="_blank" href="https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html">guide provided</a> for setting up static websites. But I found myself getting lost with clicking on a link to another link and so forth. I started researching other guides to make up for knowledge gaps.</p>
<p>I found this this excellent <a target="_blank" href="https://victoria.dev/verbose/hosting-your-static-site-with-aws-s3-route-53-and-cloudfront/">guide by Victoria Drake</a>.</p>
<p>I followed Victoria Drake’s guide alongside the AWS one and managed to muddle through. But there were still a few things that were not explained which I hope to flesh out.</p>
<p>Before we proceed, here is your to do list:</p>
<ul>
<li><p>Do some research on domain registrars and buy your domain name.</p>
</li>
<li><p>Sign up for a free account with AWS.</p>
</li>
<li><p>Have both the <a target="_blank" href="https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html">documentation from AWS</a> and <a target="_blank" href="https://victoria.dev/verbose/hosting-your-static-site-with-aws-s3-route-53-and-cloudfront/">Victoria Drake’s guide open</a>. Use my guide to guide you through the documentation (hope that makes sense!).</p>
</li>
</ul>
<p>Here we go!</p>
<h4 id="heading-aws-create-a-hosted-zone-on-route-53"><strong>AWS: Create a Hosted Zone on Route 53.</strong></h4>
<p>Route 53 is where all your DNS requests are handled.</p>
<p>The first thing you must set up is your hosted zone with Route 53. This is really easy if you bought your domain through AWS. A hosted zone is created automatically once you’ve purchase it. If you’ve done this then just skip to the next section (<strong>Set up your S3 Buckets</strong>).</p>
<p>However, if you were like me and bought your domain name via another registrar then please do the following.</p>
<p><strong>This next part is how to create a Hosted Zone on Route 53 if you haven’t bought your domain name from AWS:</strong></p>
<ol>
<li><a target="_blank" href="https://console.aws.amazon.com/route53/home?#hosted-zones:">Go to Route 53</a> in your console and click on “Create Hosted Zone”. Fill in your domain address, comment is optional and choose a “Public Hosted Zone”. Click on “Create”.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/hostedzone1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="2">
<li>Once your hosted zone is created, you need your NS (Name Servers) records:</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/hostedzone2-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="3">
<li>Go to your domain name registrar and login. Depending on your registrar, you should find a section in your settings called "Nameservers" which you can edit. You need to copy across the AWS NS records and change the existing NS records in your domain settings.</li>
</ol>
<p>Please note, don't copy the full stop/period at the end of the NS record. For example, is should be “ns-63.awsdns-07.com”, not “ns-63.awsdns-07.com.”</p>
<p><strong>It will take up to 24 hours to propagate.</strong></p>
<h3 id="heading-set-up-your-s3-buckets"><strong>Set up your S3 Buckets</strong></h3>
<p>In the meantime you can set up your S3 Buckets. The S3 Bucket is the storage for your files such as your index.html.</p>
<p>You must configure two buckets for your website: 1) yourdomainname.com and 2) www.yourdomainname.com.</p>
<p>The first bucket is your main bucket where you will upload all your documents, such as your index.html. The second bucket redirects to the first bucket. To set up your S3 Buckets, please follow the AWS documentation on how to set up your S3 bucket ( <a target="_blank" href="https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html#root-domain-walkthrough-s3-tasks">2: Create and Configure Buckets and Upload Data</a>).</p>
<p>In addition to the documentation, there are a few things to note:</p>
<ul>
<li><p>In section 2.1 (part 2): click on the link <a target="_blank" href="https://docs.aws.amazon.com/AmazonS3/latest/user-guide/create-bucket.html">How Do I Create an S3 Bucket?</a> This is a step by step guide and explain all the settings you need to choose.</p>
</li>
<li><p>In section 2.1 (part 3): you don’t have to upload your website files yet. You can add a test index.html in the meantime.</p>
</li>
</ul>
<p>Take note of your <strong>endpoint</strong>. You can find this in your S3 bucket &gt; “Properties” tab &gt; “Static Web Hosting” box. It should look something like this: http://yourdomainname.com.s3-website.eu-west-2.amazonaws.com</p>
<h3 id="heading-add-the-aliasa-records-in-route-53"><strong>Add the Alias/“A” records in Route 53</strong></h3>
<p>Finally go back to Route 53 and open your hosted zone to set up your Alias records. You can follow <a target="_blank" href="https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html#root-domain-walkthrough-add-arecord-to-hostedzone">the documentation</a> on “Step 3: Add Alias Records for example.com and www.example.com”. It is quite straightforward.</p>
<p>Once the NS settings have propagated, <strong>your site is live</strong>! You’ll be able to visit your site at the domain address e.g. yourdomainname.com</p>
<p>However, please note that it won’t be secure and you’ll see a <strong>http://</strong> prefix in the address bar. I’ll get to that in the next section.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/undraw_security_o890.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-how-to-make-your-website-secure-and-what-is-a-ssl-certificate"><strong>How to make your website secure and what is a SSL certificate?</strong></h3>
<p>It’s very important to make your website secure and to do this you’ll need to get an SSL certificate. SSL stands for <a target="_blank" href="https://en.wikipedia.org/wiki/Transport_Layer_Security">Secure Sockets Layer</a> and it uses encryption to securely transfer data between a user and site. Google will also give a rankings boost for websites with HTTPS.</p>
<p>If you secure the website with an SSL certificate, you’ll see <strong>https://</strong> and a padlock symbol in your address bar.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/Screen-Shot-2019-01-19-at-01.05.23.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>There are different types of SSL certificates: <a target="_blank" href="https://en.wikipedia.org/wiki/Extended_Validation_Certificate">Extended Validation Certificate</a> and a <a target="_blank" href="https://en.wikipedia.org/wiki/Domain-validated_certificate">Domain validated certificate</a>. For a personal website or blog, only a domain validated certificate is required. You also won’t see the name of your company on the left of the bar like the example above. You only get this if you have an Extended Validation Certificate which is more for large companies/enterprises.</p>
<h3 id="heading-how-much-does-it-cost-for-an-ssl-certificate"><strong>How much does it cost for an SSL certificate?</strong></h3>
<p>I’ve seen a range of ways of getting an SSL certificate. You can pay a premium for a service that will do this on your behalf or you can do it for free with <a target="_blank" href="https://letsencrypt.org/getting-started/">Let’s Encryp</a>t. Let’s Encrypt is an official Certificate Authority (CA). But you have to renew your certificate every three months and the process is quite complicated.</p>
<p>I didn’t want to pay a premium or want the hassle of renewing every three months. Conveniently, AWS can issue SSL certificates for a <a target="_blank" href="https://aws.amazon.com/certificate-manager/pricing/">very small fee</a>. You pay $0.75 for each certificate issued and it lasts for one year.</p>
<p>If you choose not to go with AWS, make sure you do your research and choose a <a target="_blank" href="https://www.geckoandfly.com/24460/free-trusted-ssl-certificate/">trusted CA</a>!</p>
<h3 id="heading-how-do-you-get-an-ssl-certificate-with-aws"><strong>How do you get an SSL certificate with AWS?</strong></h3>
<p>Log into your AWS console and navigate to the <a target="_blank" href="https://aws.amazon.com/certificate-manager/">AWS Certificate Manager</a> (ACM).</p>
<p><strong>Make sure you change the region from the default (Ohio) to N. Virginia.</strong> This is not explicit in the guides and only the N. Virginia region can issue certificates. I learned the hard way and wasted a lot of time!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/Screen-Shot-2019-01-19-at-01.23.52.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Then click on “Get Started” under “Provision Certificates”.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/Screen-Shot-2019-01-18-at-14.55.14.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Follow the <a target="_blank" href="https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html">documentation with AWS</a> (“Requesting a public certificate using the console”) and use <a target="_blank" href="https://vickylai.com/verbose/hosting-your-static-site-with-aws-s3-route-53-and-cloudfront/">Victoria Drake’s guide</a> (under “SSL certificate”).</p>
<p><strong>In addition to the guides</strong> there are few things that weren’t fully explained:</p>
<ul>
<li><p>You’ll need to <strong>validate your domain ownership</strong> by email or directly with DNS. I would suggest to always verify ownership by <a target="_blank" href="https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-validate-dns.html"><strong>DNS validation</strong></a>.</p>
</li>
<li><p>Once you’ve requested your certificate you’ll get something like this (except the status will be pending). Click on the “Export DNS Configuration file”:</p>
</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/acm.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>It’s an Excel spreadsheet which will contain something like this:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/Screen-Shot-2019-01-18-at-15.28.11.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li><p>You’ll need to add these records to your DNS settings with your registrar. Log in and go to DNS settings. The interface varies with different registrars but you’re looking for your Host records under your DNS settings.</p>
</li>
<li><p>Click on “Add Record” &gt; record type is <strong>CNAME</strong>:</p>
</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/Screen-Shot-2019-01-18-at-15.48.11.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>You need to add two records: 1) Hostname should be “@” and Target Name should be the Record value from the DNS configuration file.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/Screen-Shot-2019-01-18-at-16.01.07.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="2">
<li>Hostname should be * (asterisk) and Target Name should be the Record value from the DNS configuration file.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/Screen-Shot-2019-01-18-at-16.01.31.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>If you want more information about the CNAME and record types, I found this <a target="_blank" href="https://help.hover.com/hc/en-us/articles/217282457-How-to-Edit-DNS-records-A-AAAA-CNAME-MX-TXT-SRV-">helpful article</a>.</p>
<p>It's quite long, but I've pulled out the useful part:</p>
<blockquote>
<p>“Note: Hostname refers to the prefix before the domain name. To create a Blank record, use an @ in the Hostname field. This represents an empty prefix (so the name exactly matches the domain name; for example divapirate.com). The @ hostname is also referred to as the the root of the domain. An * (asterisk) in the Hostname is a wildcard, and represents any prefix. For example, creating a record for *.divapirate.com will point .divapirate.com at the IP address provided.”</p>
</blockquote>
<p>You just need to wait for the verification. For me, this took about an hour.</p>
<h3 id="heading-how-do-you-add-your-ssl-certificate"><strong>How do you add your SSL certificate?</strong></h3>
<p>With AWS you can add SSL certificate to your website through setting up <a target="_blank" href="https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-cloudfront-walkthrough.html"><strong>CloudFront</strong></a>. CloudFront is great for speeding up your website. I used the <a target="_blank" href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-https.html">AWS documentation</a> and <a target="_blank" href="https://victoria.dev/verbose/hosting-your-static-site-with-aws-s3-route-53-and-cloudfront/">Victoria Drake’s guide</a> (look out for her useful tips).</p>
<p>Please note, when you create your CloudFront distribution, there’s a drop down menu to add your SSL certificate. If you have been issued with an SSL certificate already, it will be pre-populated in the drop down menu.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/Screen-Shot-2019-01-19-at-01.36.02-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Your state in your CloudFront dashboard should changed to “Enabled”. This isn’t instant and takes a little time.</p>
<h3 id="heading-almost-there"><strong>Almost there…</strong></h3>
<p>Finally, you need to get your <strong>Domain Name</strong> from the CloudFront distribution. It should be something like this dsfdser83543.<strong>cloudfront.net</strong>.</p>
<p>Go back to Route 53 &gt; hosted zone &gt; change both Alias records (Alias Target) to the CloudFront Domain Name.</p>
<p>Voila! You have hosted your first <strong>secure static website</strong> with AWS.</p>
<hr>
<p>Hope you found this useful. If you have any questions or just want to say hello, find me on Twitter <a target="_blank" href="https://twitter.com/PhoebeVF">@PhoebeVF</a></p>
<p>A big thank you to Victoria Drake for her guide. For a more advanced tutorial on this topic, please check out Victoria's article: <a target="_blank" href="https://victoria.dev/verbose/hosting-your-static-site-with-aws-s3-route-53-and-cloudfront/">"Hosting your static site with AWS S3, Route 53, and CloudFront"</a>.</p>
<p>Illustrations courtesy of <a target="_blank" href="https://undraw.co/">https://undraw.co</a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to host a Git repository on a subdomain with Netlify ]]>
                </title>
                <description>
                    <![CDATA[ By Glyn Lewington Let’s say you have your portfolio, like [www.glynlewington.com](http://www.glynlewington.com), hosted on Netlify and want to add your projects onto the same domain. They are all separate git repositories and Netlify is made for host... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-host-a-git-repository-on-a-subdomain-with-netlify-b8afb5fca96e/</link>
                <guid isPermaLink="false">66d45edda3a4f04fb2dd2e45</guid>
                
                    <category>
                        <![CDATA[ Netlify ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 23 May 2019 15:15:15 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/0*yd8PzBwBVOc98lXb" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Glyn Lewington</p>
<p>Let’s say you have your portfolio, like <code>[www.glynlewington.com](http://www.glynlewington.com)</code>, hosted on Netlify and want to add your projects onto the same domain. They are all separate git repositories and Netlify is made for hosting from a single repository…but don’t fear! We can host them on subdomains like <code>project.glynlewington.com</code> with just a little work.</p>
<p>Netlify makes it super easy to host your static sites with them for free. I recently moved my portfolio from a VPS over to them, and it’s great that they automatically update your site every time you push to your git repository.</p>
<p>In the past, I had all my personal projects also hosted on subdirectories, e.g. <code>www.glynlewington.com/project</code>. This is either difficult or impossible with Netlify. Netlify is mostly set up for you to host everything in one site from one git repository.</p>
<p>The compromise I came to is hosting them on subdomains instead, like <code>project.glynlewington.com</code>. This also isn’t documented very well but it is possible.</p>
<ul>
<li>Go to <a target="_blank" href="http://www.netlify.com,">www.netlify.com</a> and login or signup.</li>
<li>Select “New site from git”.</li>
<li>Choose your provider (e.g. GitHub) — You may need to authenticate here.</li>
<li>Select the git repository you want to create a site from.</li>
<li>Select the branch you want to deploy from.</li>
<li>Choose any commands that need to be run. — <em>If it’s a React app you will need to run a build command.</em></li>
<li>Choose the directory that you will publish from. It will contain files such as index.html. — <em>If it’s a React app this will probably be the build folder.</em></li>
<li>Select “Build Site”.</li>
</ul>
<p>At this point, you should have a functioning app hosted on a Netlify free domain such as <code>https://hungry-bose-fb0e6d.netlfiy.com</code>. If this isn’t working, check that there are no errors with the build process and fix these if there are.</p>
<p>Now to set up a custom domain.</p>
<ul>
<li>Go into your app overview on Netlify.</li>
<li>It will say your site is deployed successfully and you can set up a custom domain.</li>
<li>Click on set up a custom domain, type in the domain you want, including the subdomain, and click verify. E.g. <code>project.glynlewington.com</code>.</li>
</ul>
<p>Next, login to your domain hosting provider. I use Cloudflare but it will be the same or similar using others.</p>
<ul>
<li>Go to DNS settings.</li>
<li>Select a new CNAME record.</li>
<li>Input a “Name” — this is the subdomain, it should be the same one you selected previously on Netlify. E.g. <code>project</code></li>
<li>Under “IPv4 Address” input the free domain for your Netlify site. E.g. <code>hungry-bose-fb0e6d.netlify.com</code>.</li>
<li>If you are also using Cloudflare, turn off the traffic routing through Cloudflare. This messes with Netlify.</li>
<li>Add record.</li>
</ul>
<p>Done! Once you’ve done this you can access your site on the subdomain.</p>
<p>Netlify will also automatically add https security to your site, no need to worry about this.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Simple site hosting with Amazon S3 and HTTPS ]]>
                </title>
                <description>
                    <![CDATA[ By Georgia Nola Hiya folks! In this tutorial I’ll show you how to host a static website with HTTPS on AWS with a custom domain. All this is possible using AWS free tier. However, the services we are going to use do incur some small charges. Generally... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/simple-site-hosting-with-amazon-s3-and-https-5e78017f482a/</link>
                <guid isPermaLink="false">66c35edca365c359945c9b64</guid>
                
                    <category>
                        <![CDATA[ AWS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud Services ]]>
                    </category>
                
                    <category>
                        <![CDATA[ S3 ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 08 Jan 2019 16:25:45 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*nKAE02IQZHWQ9oqNgGX3ag.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Georgia Nola</p>
<p>Hiya folks!</p>
<p>In this tutorial I’ll show you how to host a static website with HTTPS on AWS with a custom domain. All this is possible using AWS free tier.</p>
<p>However, the services we are going to use do incur some small charges. Generally speaking these shouldn’t exceed $1/month.</p>
<p>We’ll be using a combination of the following AWS services:<br> —S3<br> — Route53<br> — Certificate manager<br>— CloudFront</p>
<p><em>Let’s get into it!</em></p>
<h3 id="heading-setup-your-s3-buckets">Setup your S3 buckets</h3>
<p>First, you’ll need <strong>two S3 buckets</strong>, both should match your custom domain name with the second including the www subdomain.</p>
<p>Bucket 1: mywebsite.com<br>Bucket 2: www.mywebsite.com</p>
<p>The first bucket (mywebsite.com) is the main bucket for your site. This contains all your files and assets for your static website.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/8tMXguNd0mEM-Kdt54Dy0WzMNvD0h0D0Moci" alt="Image" width="564" height="556" loading="lazy"></p>
<p>Next we setup this bucket for static site hosting. You can find this under the Properties tab of the bucket, and we’re going to keep the defaults provided here with the index of the site set to index.html.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/-HHilv-8c1Y3OHdtaZhJR9DNlphJOBFd87gy" alt="Image" width="800" height="506" loading="lazy"></p>
<p>We also need to make this bucket publicly accessible as a user’s browser will need to access the bucket’s files in order to render the website. We can do this by setting a Bucket Policy under the Permissions tab.</p>
<pre><code>{       <span class="hljs-string">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,       <span class="hljs-string">"Statement"</span>: [        {            <span class="hljs-string">"Sid"</span>: <span class="hljs-string">"PublicReadGetObject"</span>,            <span class="hljs-string">"Effect"</span>: <span class="hljs-string">"Allow"</span>,            <span class="hljs-string">"Principal"</span>: <span class="hljs-string">"*"</span>,            <span class="hljs-string">"Action"</span>: <span class="hljs-string">"s3:GetObject"</span>,            <span class="hljs-string">"Resource"</span>: <span class="hljs-string">"MY_BUCKET_ARN"</span>        }    ]}
</code></pre><p>This is a simple policy that will only allow public read access of objects in the bucket. Now, if you head to the endpoint defined in the static hosting config of the bucket, you should see your website.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/yEcjdf6UEr8iPVBjQCT0CtidDLpUQyhQCbLG" alt="Image" width="800" height="475" loading="lazy"></p>
<p>Progress! But we can do better than that.</p>
<p>The second bucket (www.mywebsite.com) we will leave empty but configure to redirect to our first bucket using HTTP as the protocol (we’ll make it HTTPS later).</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/MphGJGErSalxmf76wjQbOGSuyhg6y50dPWxT" alt="Image" width="800" height="419" loading="lazy">
<em>Redirect requests back to the main bucket using HTTP protocol</em></p>
<p>Your buckets are now ready to go!</p>
<h3 id="heading-configure-domains-with-route53">Configure Domains with Route53</h3>
<p>So your website is up and running but only accessible via the bucket endpoint and not your custom domain. Let’s change that.</p>
<p>Head to <strong>Route53</strong>. If you’ve registered your domain with the Amazon Registrar you should see that a hosted zone has been setup for you with two record sets. One for Name Server (NS) and one for SOA.</p>
<p>All we need to do is to create two more record sets to point to the S3 bucket endpoints.</p>
<p>For each record set:<br> — Type: A — IPv4 address<br> — Alias: Yes<br> — Alias Target: the S3 website endpoint that matches what you set for Name.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/-pRXjHHB-EmOPzuTcNbKribluPQTsshaCGf-" alt="Image" width="562" height="324" loading="lazy">
<em>Creating a record set for www subdomain</em></p>
<p>Now we can head to the custom url…and voilà!<br>We’re almost there, but there’s one last thing we’re missing…</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/Tn5XmMFeKZDKn2zLITzmEfYtBOP6OH2ZSrVl" alt="Image" width="800" height="356" loading="lazy"></p>
<p><strong>Note</strong>: If your domain is registered with another domain registrar (not Amazon) you’ll need to follow some different steps to set this up. Usually you’ll need to add a CNAME record with a value of the main S3 buckets endpoint.</p>
<p><strong>Troubleshooting</strong>:<br>If you deleted the hosted zone Amazon created when you first registered the domain (I’ve done this because hosted zones do incur some charges), you’ll need to create a new hosted zone from scratch.</p>
<ol>
<li>Select “Create Hosted Zone” and set the domain name, for example “mywebsite.com”</li>
<li>This will generate some new record sets for types NS and SOA.</li>
<li>Go into your registered domain and update the Name Servers values to those generated in the new NS record set.</li>
</ol>
<h3 id="heading-requesting-a-certificate">Requesting a Certificate</h3>
<p>Awesome, the site is now hosted using the custom url! However we can only access it via HTTP protocol.<br>We should always ensure our sites are secured using HTTPS protocol. This protects our site and users from malicious injection attacks and guarantees authenticity.</p>
<p>Head to <strong>Certificate Manager</strong> in AWS Console and request a new public certificate (this is free). You’ll be prompted to enter the domain names you wish to secure.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/nklZPz8lBuVETFkAxoKadUuDn3PLvztVIH3J" alt="Image" width="633" height="435" loading="lazy"></p>
<p>Before the certificate can be issued, Amazon needs to be able to verify that you own the specified domains.</p>
<p>You can choose from two verification methods: Email or DNS.</p>
<p>Email is generally simpler, but you’ll need to ensure you can access the email used to register the domain. Alternatively, if you used Amazon Registrar and Route53, you can select the DNS method. This requires you to add some specific record sets to the hosted zone, but this is mostly automated for you so it’s quite simple.</p>
<p>It can take a few minutes for the certificate to be issued after validation.<br>When its all done we can continue to the final step!</p>
<h3 id="heading-configuring-cloudfront">Configuring CloudFront</h3>
<p>For the final step we are going to use <strong>CloudFront</strong> which allows us to use the new SSL certificate to serve the website with HTTPS. CloudFront also speeds up the distribution of web content by storing it at multiple edge locations and delivering from the closest edge location to a user.</p>
<p>We need <strong>two new web distributions</strong>, one for each S3 bucket. Head to CloudFront in the AWS Console and create the first web distribution.<br>There are lots of settings available to create a web distribution, but for the basics we only need to change five:</p>
<ol>
<li><strong>Origin Domain Name</strong>: Set this to the S3 website endpoint for one of the buckets. <strong>Important</strong>: This field will give you some auto-complete options with your S3 bucket names. However, using these can cause issues with redirecting to the bucket endpoint. So instead use the bucket endpoint directly.</li>
<li><strong>Origin Id</strong>: This populated for you when you enter Origin Domain Name.</li>
<li><strong>Viewer Protocol Policy</strong>: Set to “Redirect HTTP to HTTPS”.</li>
<li><strong>Alternate Domain Names</strong>: This should match the name of the S3 bucket you’re pointing to. For example “mywebsite.com”.</li>
<li><strong>SSL Certificate</strong>: Select “Custom SSL Certificate” and select your new certificate from the dropdown.</li>
</ol>
<p>Do this again for the second S3 bucket.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/yAhOQRit35ON9mB7rtO4aefi6w2o9r-RQ2p1" alt="Image" width="800" height="605" loading="lazy"></p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/AUfGClmx76ORz-sEOSipOFrJmBQE6KH2pDpf" alt="Image" width="800" height="511" loading="lazy"></p>
<p>The distributions can take a while to spin up, so while we wait, let’s do the finishing steps.</p>
<p>Back in <strong>S3</strong>, go to your secondary bucket (www.mywebsite.com), in the Properties tab and under Static Website Hosting set the redirect protocol to HTTPS.</p>
<p>Finally, head back to <strong>Route53</strong>. We need to update the custom A records we created to now target the CloudFront distributions rather than the S3 buckets. For each record, change the Alias Target and select the CloudFront distribution available in the dropdown.</p>
<p>Note: Again, if you are using another DNS service you’ll need to go update the CNAME record from there to point to the CloudFront domain name.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/9PtEunXXDJGvAsXD03ZFepeSNosGtlXC-SWl" alt="Image" width="800" height="392" loading="lazy">
<em>Huzzah!</em></p>
<p>And there you have it! Your beautiful website is now available at the custom domain and served with HTTPS!</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1q28QH0CERJRnMkDZdrmOImMQD7szHNf5xZI" alt="Image" width="496" height="360" loading="lazy">
_[From Giphy](https://giphy.com" rel="noopener" target="<em>blank" title=")</em></p>
<p>Thanks for reading! I hope this guide was useful and enjoyable, I’d love to know if you found it helpful.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to host multiple domain names and projects on one server ]]>
                </title>
                <description>
                    <![CDATA[ By BinHong Lee NGINX is one magical tool _Photo by [Unsplash](https://unsplash.com/@imgix?utm_source=medium&utm_medium=referral" rel="noopener" target="_blank" title="">imgix on <a href="https://unsplash.com?utm_source=medium&utm_medium=referral" re... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-you-can-host-multiple-domain-names-and-projects-in-one-vps-7aed4f56e7a1/</link>
                <guid isPermaLink="false">66c356bffd47bc6e657cb87d</guid>
                
                    <category>
                        <![CDATA[ nginx ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ servers ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 29 Aug 2018 16:50:07 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/0*FT9uL7NRg2iep6-e" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By BinHong Lee</p>
<h4 id="heading-nginx-is-one-magical-tool">NGINX is one magical tool</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/0*FT9uL7NRg2iep6-e" alt="Image" width="800" height="476" loading="lazy">
_Photo by [Unsplash](https://unsplash.com/@imgix?utm_source=medium&amp;utm_medium=referral" rel="noopener" target="_blank" title=""&gt;imgix on &lt;a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral" rel="noopener" target="<em>blank" title=")</em></p>
<p>I own multiple domain names, and each one hosts a different side project. For the longest time, everything that required ‘hosting’ was hosted on Heroku. But their free tier can be quite limited, it can also get costly quickly if you are paying for each separate project. So instead, I decided to explore putting all of them together using NGINX (recommended to me by <a target="_blank" href="https://www.freecodecamp.org/news/how-you-can-host-multiple-domain-names-and-projects-in-one-vps-7aed4f56e7a1/undefined">Jane Manchun Wong</a>).</p>
<h3 id="heading-required-resources">Required Resources</h3>
<h4 id="heading-virtual-private-server-vps">Virtual Private Server (VPS)</h4>
<p>You’ll need a virtual server such as <a target="_blank" href="https://www.freecodecamp.org/news/how-you-can-host-multiple-domain-names-and-projects-in-one-vps-7aed4f56e7a1/undefined">DigitalOcean</a> or EC2 by <a target="_blank" href="https://www.freecodecamp.org/news/how-you-can-host-multiple-domain-names-and-projects-in-one-vps-7aed4f56e7a1/undefined">AWS</a>. Personally I uses <a target="_blank" href="https://www.vultr.com/?ref=7358373">Vultr</a> (here’s the <a target="_blank" href="http://vultr.com/">non-referral link</a>) which costs me about $2.50 / month.</p>
<h4 id="heading-domain-names">Domain Names</h4>
<p>You will need to register a few domain names. Assuming that you probably already have them, make sure your domain names are pointing at the name servers of your VPS. There should be a DNS section in your domain name service dashboard where you can select “custom DNS” or something similar. If you are not sure what the nameservers of your VPS are, you should be able to find that info easily through a simple search of “nameserver” + VPS service name.</p>
<h3 id="heading-setting-up-nginx">Setting up NGINX</h3>
<h4 id="heading-installation-and-basic-setup">Installation and basic setup</h4>
<p><em>Reference from <a target="_blank" href="https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04">How To Install Nginx on Ubuntu 16.04</a></em></p>
<p>Run the following commands through SSH-ing into the VPS. It will install NGINX, set firewall rules allowing it, and set NGINX to autostart on boot.</p>
<h4 id="heading-configuration-setup">Configuration setup</h4>
<p><em>Reference from <a target="_blank" href="https://geekflare.com/multiple-domains-on-one-server-with-apache-nginx/">Host Multiple Domains on One Server/IP with Apache or nginx</a></em></p>
<p>The default virtual.conf location should be at /etc/nginx/conf.d/virtual.conf. I recommend backing up the default file before making any changes. (If it doesn’t exist, you can just create it.) Edit the file to look something like the following:</p>
<p>Here are a few things to look at:</p>
<ul>
<li><em>server</em> block — Each of these should represent each different domain or subdomain in use.</li>
<li><em>root</em> — This is the location where the (HTML) files are loaded from.</li>
<li>_server<em>name</em> — (sub)domain name(s) that should load these specific files.</li>
<li>_proxy<em>redirect</em> — in cases where you are redirecting a specific subdomain to an active server, you will want to add this and put the IP location after it. (For local servers, either <a target="_blank" href="http://127.0.0.1:port"><em>http://127.0.0.1:port</em></a> or <a target="_blank" href="http://localhost:port"><em>http://localhost:port</em></a> should work as intended.)</li>
</ul>
<pre><code>sudo systemctl restart nginx
</code></pre><p>After you are done, restart the server so the new configurations will be loaded and applied.</p>
<h3 id="heading-cloning-and-linking">Cloning and linking</h3>
<p>Now remember, since you have your directory pointing at /opt/htdocs/<em>websiteName</em>, your initial thought might be to clone your projects into these folders. This can work, but it’s not ideal since many operations in these folders require root access to really do anything.</p>
<p>Instead, you can clone them into your user folder or anywhere else like you normally would, and then create a soft link to connect the path to your repository folder. Something like this:</p>
<pre><code>git clone git@github.com:binhonglee/binhonglee.github.io ~<span class="hljs-regexp">/websitesudo ln -s ~/</span>website /opt/htdocs/binhong
</code></pre><p>Of course, when you are cloning a Node.js static site folder (ReactJS, Angular or Vue.js), you will want to install (<code>npm install</code>) and build (<code>npm run-script build</code>) them. Then link the <em>./build</em> folder instead of the base level of the cloned repository. (Similarly for Jekyll sites, but use the _./<em>output</em> folder instead.) As for active servers, just make sure your server is running on the same port as it is listed in the configuration file.</p>
<h3 id="heading-set-up-https-with-certbot">Set up HTTPS with certbot</h3>
<p>Thanks to Let’s Encrypt, you can now get free and easy HTTPS certificates. With the introduction of certbot, everything just got even easier!</p>
<p><em>Reference from <a target="_blank" href="https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04">How To Secure Nginx with Let’s Encrypt on Ubuntu 16.04</a></em></p>
<p>Just run the above for all your domain and subdomain names and certbot will take care of everything. If you were to renew the certs, you can run the following so the certbot will help you renew your SSL certificate.</p>
<pre><code>sudo certbot renew --dry-run
</code></pre><h3 id="heading-updating-everything">Updating everything</h3>
<p>Now that you have everything up and running, you might be thinking, well there seems to be an awful lot to remember if/when I need to update something. Unfortunately, that’s kinda true, but we can always make it easier by adding a script that does it for us.</p>
<p>Here is how one would look:</p>
<p>Thanks for reading! Let me know if you have any questions in the comments below.</p>
<h3 id="heading-about-me">About me</h3>
<p>At the time of writing, I work at Apple Inc. in the role of Siri Language Engineer as an Independent Contractor through AdvantisGlobal. I spend a lot of my free time experimenting and building new things with technologies I find fun and interesting. Follow my exploration journey <a target="_blank" href="https://binhong.me/blog">here</a> or on <a target="_blank" href="https://github.com/binhonglee">GitHub</a>.</p>
<h3 id="heading-other-references">Other References</h3>
<ul>
<li><a target="_blank" href="https://serverfault.com/questions/363159/nginx-proxy-pass-redirects-ignore-port">nginx proxy pass redirects ignore port</a> on <a target="_blank" href="https://serverfault.com">serverfault</a></li>
<li><a target="_blank" href="https://superuser.com/questions/632205/continue-ssh-background-task-jobs-when-closing-ssh">Continue SSH background task/jobs when closing SSH</a> on <a target="_blank" href="https://superuser.com/">superuser</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How I made my portfolio website blazing fast with Gatsby ]]>
                </title>
                <description>
                    <![CDATA[ By Maribel Duran If you are thinking of building a static site with React and want it to perform as fast as a cheetah, you should consider using GatsbyJS.  I decided to try it out and was amazed with how easy it was to setup, deploy, and how fast ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-i-made-my-portfolio-website-blazing-fast-with-gatsby-82ccddc2f671/</link>
                <guid isPermaLink="false">66d46014733861e3a22a732a</guid>
                
                    <category>
                        <![CDATA[ GatsbyJS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Sun, 12 Aug 2018 19:25:48 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*lJOurCBMozvgBjmxG-Ljiw.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Maribel Duran</p>
<p>If you are thinking of building a static site with React and want it to perform as fast as a cheetah, you should consider using GatsbyJS. </p>
<p>I decided to try it out and was amazed with how easy it was to setup, deploy, and how fast the site loads now. Gatsby uses the best parts of other front end tools to make the development experience feel like you’re on vacation.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/drwxddrKcWMNLOQ0Vc0Th9-DH2BAtln6DfzA" alt="Image" width="800" height="347" loading="lazy">
<em>After rebuilding my website with Gatsby and React ?</em></p>
<h3 id="heading-performance-issues-with-original-website"><strong>Performance Issues With Original Website</strong></h3>
<p>I had been meaning to optimize the images on my portfolio website, which was one of my first freeCodeCamp Frontend Development projects.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/ZAKgKErGeMpDsVyLQi9MUYZeV6nchQeK95Z3" alt="Image" width="800" height="377" loading="lazy">
<em>Before the help of Gatsby -</em>-_</p>
<p>Ouch! A 33/100 Google optimization score was painful to see. Yup I needed some help from the optimization gods. My website contained at least 17 project screenshots. I didn’t want to have to compress each image, generate multiple sizes and resolutions of each image, and lazy-load them.</p>
<p>When I first created this website, the Bootstrap 3 <code>img-responsive</code> class took care of scaling the images to fit different screen sizes, but I didn’t think about the fact that it was still loading some of my screenshots that were around 1400 x 860 pixels on mobile devices!</p>
<p>My score was also low because I had not minified my CSS or setup browser caching for it, and was not async loading external CSS resources.</p>
<h3 id="heading-gatsby-to-the-rescue"><strong>Gatsby To The Rescue</strong></h3>
<p>I really wanted to rebuild this project using React. I could have used <a target="_blank" href="https://reactjs.org/docs/create-a-new-react-app.html">create-react-app</a> which provides an out-of-the box build script and development server, but this still didn’t take care of the long task of having to crop different image sizes for all of my images.</p>
<p>Fortunately I was listening to <a target="_blank" href="https://syntax.fm/">Syntax’s</a>, “Why Static Site Generators are Awesome” <a target="_blank" href="https://syntax.fm/show/034/why-static-site-generators-are-awesome">episode</a>, and they talked about a few static site generators on the <a target="_blank" href="https://www.staticgen.com/">StaticGen.com</a> list. If you haven’t heard what static site generators do, they transform your site into a directory with a single HTML file and static assets. No database or server code needed.</p>
<p>Gatsby won me over due to the similarities it has with create-react-app, which includes hot reloading, easy dev environment setup, and a build script. Gatsby takes it further by offering server-side rendering, smart image loading, and dedication to performance.</p>
<p>Since Gatsby is built on the React, GraphQL, and Webpack stack, we can write our content as React components! Winning! Gatsby takes care of rendering at build time to the DOM as static HTML, CSS, and JavaScript.</p>
<h3 id="heading-gatsby-image-component-is-bae">Gatsby-image Component is BAE</h3>
<p>So now to what I’ve really been wanting to share with you. Gatsby-image! <a target="_blank" href="https://www.gatsbyjs.org/packages/gatsby-image/">Gatsby-image</a>, is a React component that was designed to work with Gatsby’s GraphQL queries to completely optimize image loading for sites.</p>
<p>The approach is to use GraphQL queries to get images of the optimal size and then display them with the gatsby-image component.</p>
<p>How did I use this component to automatically create 3 thumbnails for each of my 17 project images? Magic! Not really, but it feels like it!</p>
<p>In my src/pages/index.js file, I queried all of the project images and gave it an alias of <strong>ProjectImgs.</strong> Since the queried data is now accessible through the data object as a prop, I was able to pass the <strong>projectImgData</strong> data (which is a node list of my project images) to my <code>&lt;Projects /&gt;</code> component:</p>
<pre><code><span class="hljs-comment">//imports</span>
<span class="hljs-keyword">const</span> HomePage = <span class="hljs-function">(<span class="hljs-params">{ data }</span>) =&gt;</span> {
  <span class="hljs-keyword">const</span> siteTitle = data.site.siteMetadata.title;
  <span class="hljs-built_in">console</span>.log(data.ProjectImgs); 
  <span class="hljs-keyword">const</span> { <span class="hljs-attr">edges</span>: projectImgData } = data.ProjectImgs;
  <span class="hljs-keyword">const</span> { <span class="hljs-attr">edges</span>: iconImgData } = data.iconImgs;
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
     <span class="hljs-tag">&lt;<span class="hljs-name">Helmet</span>
      <span class="hljs-attr">title</span>=<span class="hljs-string">{siteTitle}</span>
      <span class="hljs-attr">link</span>=<span class="hljs-string">{[{</span> <span class="hljs-attr">rel:</span> "<span class="hljs-attr">icon</span>", <span class="hljs-attr">type:</span> "<span class="hljs-attr">image</span>/<span class="hljs-attr">png</span>", <span class="hljs-attr">href:</span> `${<span class="hljs-attr">favicon</span>}`}]}
     /&gt;</span>
     <span class="hljs-tag">&lt;<span class="hljs-name">Cover</span> <span class="hljs-attr">coverImg</span>=<span class="hljs-string">{data.coverImg}</span> /&gt;</span>
     <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"container-fluid main"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">Navigation</span> /&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">AboutMe</span> <span class="hljs-attr">profileImg</span>=<span class="hljs-string">{data.profileImg}</span> <span class="hljs-attr">iconImgs</span>=<span class="hljs-string">{iconImgData}</span> 
      /&gt;</span>                
     <span class="hljs-tag">&lt;<span class="hljs-name">Projects</span> <span class="hljs-attr">projectImgs</span>=<span class="hljs-string">{projectImgData}</span> /&gt;</span>
     <span class="hljs-tag">&lt;<span class="hljs-name">Contacts</span> /&gt;</span>
     <span class="hljs-tag">&lt;<span class="hljs-name">Footer</span> /&gt;</span>
     <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
};
<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> query = graphql<span class="hljs-string">`
  query allImgsQuery {
    //additional queries
    ...
    ProjectImgs: allFile(
      sort: { order: ASC, fields: [absolutePath] }
      filter: { relativePath: { regex: "/projects/.*.png/" } }
    ) {
      edges {
        node {
          relativePath
          name
          childImageSharp {
            sizes(maxWidth: 320) {
              ...GatsbyImageSharpSizes
            }
          }
        }
      }
    }
//additional queries
...
  }
`</span>;
</code></pre><blockquote>
<p>Note: I had some trouble getting my graphQL queries to work and had to do a little digging around to figure out how to query for multiple images within a folder. What helped me was looking at other portfolio sites made with Gatsby.</p>
</blockquote>
<p>Using the console, we can see what <code>data.ProjectImgs</code> returns to give you a better idea of what I am receiving from the query and what I am passing to my Projects component:</p>
<p><code>Console.log(data.ProjectImgs)</code> returns an array of edges:</p>
<pre><code>{<span class="hljs-attr">edges</span>: <span class="hljs-built_in">Array</span>(<span class="hljs-number">17</span>)}
<span class="hljs-attr">edges</span>
:
(<span class="hljs-number">17</span>) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
<span class="hljs-attr">__proto__</span>
:
<span class="hljs-built_in">Object</span>{<span class="hljs-attr">edges</span>: <span class="hljs-built_in">Array</span>(<span class="hljs-number">17</span>)}
</code></pre><p>Extending one of the edges shows a node object that contains a <strong>childImageSharp</strong> property. This contains a sizes object which holds the image’s thumbnail sources. This sizes object is what we ultimately want to pass to our gatsby-image’s <code>&lt;Img /&gt;</code> component.</p>
<p>Extending an edge to show the information in a node:</p>
<pre><code>{<span class="hljs-attr">edges</span>: <span class="hljs-built_in">Array</span>(<span class="hljs-number">17</span>)}
 <span class="hljs-attr">edges</span>: <span class="hljs-built_in">Array</span>(<span class="hljs-number">17</span>)
 <span class="hljs-number">0</span>:
  node:
   childImageSharp: {<span class="hljs-attr">sizes</span>: {…}}
   <span class="hljs-attr">name</span>: <span class="hljs-string">"CamperLeaderboard"</span>
   <span class="hljs-attr">relativePath</span>:<span class="hljs-string">"projects/CamperLeaderboard.png"</span>
   <span class="hljs-attr">__proto__</span>:<span class="hljs-built_in">Object</span>
   <span class="hljs-attr">__proto__</span>:<span class="hljs-built_in">Object</span>
 <span class="hljs-number">1</span>:{<span class="hljs-attr">node</span>: {…}}
<span class="hljs-comment">//more nodes</span>
...
</code></pre><p>In my <code>&lt;Projects /&gt;</code> component, I receive the node list of project images as a prop and for each project, I extract the <strong>childImageSharp.sizes</strong> object (which is renamed to <strong>imageSizes</strong>), and pass it into the gatsby-image’s <code>&lt;Img /&gt;</code> component:</p>
<pre><code><span class="hljs-keyword">import</span> React, { Component } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
<span class="hljs-keyword">import</span> Img <span class="hljs-keyword">from</span> <span class="hljs-string">"gatsby-image"</span>;
<span class="hljs-comment">//more imports</span>
...
class Projects <span class="hljs-keyword">extends</span> Component {
  <span class="hljs-keyword">constructor</span>(props) {
    <span class="hljs-built_in">super</span>(props);
  <span class="hljs-built_in">this</span>.state = {
      <span class="hljs-attr">selectedType</span>: <span class="hljs-string">"front-end"</span>
   };
  <span class="hljs-built_in">this</span>.onSelectChange = <span class="hljs-built_in">this</span>.onSelectChange.bind(<span class="hljs-built_in">this</span>);
  }

  onSelectChange(e) {
    <span class="hljs-built_in">this</span>.setState({ <span class="hljs-attr">selectedType</span>: e.target.value });
 }
render() {
    <span class="hljs-keyword">const</span> projectImgs = <span class="hljs-built_in">this</span>.props.projectImgs;
    <span class="hljs-keyword">const</span> { selectedType } = <span class="hljs-built_in">this</span>.state;
    <span class="hljs-keyword">return</span> (
      <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">section</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"projects"</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"section projects"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">h2</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"text-center"</span>&gt;</span>PROJECTS<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"section-content"</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"subheader"</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">FormGroup</span> <span class="hljs-attr">controlId</span>=<span class="hljs-string">"formControlsSelect"</span>&gt;</span>
             ...
            <span class="hljs-tag">&lt;/<span class="hljs-name">FormGroup</span>&gt;</span>
          <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"project-list"</span>&gt;</span>
            {projectList.map(project =&gt; {
              const isSelectedType = selectedType === project.type;
              const singleCardClass = classNames("single-card", {
                hide: !isSelectedType
               });
              const image = projectImgs.find(n =&gt; {
                return n.node.relativePath === 
                       `projects/${project.img}`;       
              });
              const imageSizes = image.node.childImageSharp.sizes;
              return (
                <span class="hljs-tag">&lt;<span class="hljs-name">a</span>
                  <span class="hljs-attr">href</span>=<span class="hljs-string">{project.url}</span>
                  <span class="hljs-attr">key</span>=<span class="hljs-string">{project.url}</span>
                  <span class="hljs-attr">className</span>=<span class="hljs-string">{singleCardClass}</span>
                  <span class="hljs-attr">target</span>=<span class="hljs-string">"_blank"</span>
                &gt;</span>
                  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"card-img"</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-name">Img</span>
                      <span class="hljs-attr">title</span>=<span class="hljs-string">{project.name}</span>
                      <span class="hljs-attr">alt</span>=<span class="hljs-string">"Screenshot of Project"</span>
                      <span class="hljs-attr">sizes</span>=<span class="hljs-string">{imageSizes}</span>
                      <span class="hljs-attr">className</span>=<span class="hljs-string">"card-img_src center-block"</span>
                    /&gt;</span>
                  <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
                  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"blue-divider"</span> /&gt;</span>
                  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"card-info"</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-name">h4</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"card-name"</span>&gt;</span>{project.name}<span class="hljs-tag">&lt;/<span class="hljs-name">h4</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>{project.description}<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
                  <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
              );
            })}
          <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span></span>
    );
  }
}
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> Projects;
</code></pre><p>And this is the end result:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/01dWYR9uwENmj6xQcoA-5uhSqdXywSDUMCyH" alt="Image" width="640" height="322" loading="lazy">
<em>Example of lazy loading and blur effect using gatsby-image in a slow 3G network</em></p>
<p>That’s it! The <code>&lt;Img /&gt;</code> component takes care of using the correct image size, creating the blur up effects, and lazy loading my project images, since they are located further down the screen. The above querying was a bit more complex than querying a single image.</p>
<p>If you’re new to GraphQL, below are a few resources that better explain how to use GraphQL queries and the gatsby-image component:</p>
<ul>
<li><a target="_blank" href="https://www.gatsbyjs.org/docs/working-with-images/">Working with Images in Gatsby</a></li>
<li><a target="_blank" href="https://www.gatsbyjs.org/packages/gatsby-image/">gatsby-image</a></li>
<li><a target="_blank" href="https://medium.com/@kyle.robert.gill/ridiculously-easy-image-optimization-with-gatsby-js-59d48e15db6e">Image Optimization Made Easy with Gatsby.js</a></li>
</ul>
<h3 id="heading-hosting-to-netlify-was-a-breeze"><strong>Hosting To Netlify Was a Breeze</strong></h3>
<p>Since Gatsby generates static files, you can pretty much use any hosting provider. I decided to change my hosting provider from Github Pages to Netlify. I had been hearing about how easy it is to deploy a website to Netlify and they were not lying. Their free tier provides awesome features that makes the deployment process and making a website secure a breeze. It provides one click HTTPS, global CDN, continuous deployment, and the list goes on.</p>
<p>The setup process was so simple. I logged into Netlify, clicked the “New site from Git” button on my dashboard, and chose the Git repository for this project. I configured the site to deploy from master and clicked “Deploy Site”. That was it! Netlify takes care of the build process and publishes it to the web.</p>
<p>As I mentioned, Netlify offers continuous deployment, so now whenever I push changes to my master branch on GitHub, this automatically triggers a new build on Netlify. Once the build is complete, my changes will be live on the web.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/sslrobbMI6Gv3V0fhuG0AQyX6wpBjKY9Fmqy" alt="Image" width="800" height="428" loading="lazy">
<em>Deployment setting is set to auto publishing</em></p>
<h3 id="heading-the-future-looks-bright"><strong>The Future Looks Bright</strong></h3>
<p>By rebuilding my website with Gatsby, not only did I learn about the different image optimization techniques for future projects, I also learned a bit about GraphQL, practiced my React skills, and took the opportunity to try out a new hosting provider.</p>
<p>I am really excited for the future of Gatsby and similar front end tools that remove the complexities of configuring environments and build tools. Instead, we can focus our energy and time on our code to build awesome stuff for our users.</p>
<blockquote>
<p>If you liked this article, click the? below so other people will see it here on Medium.  </p>
<p>Let’s be friends on <a target="_blank" href="https://twitter.com/maribeldotduran">Twitter</a>. Happy Coding :)</p>
</blockquote>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to get started using Firebase Hosting ]]>
                </title>
                <description>
                    <![CDATA[ Interested in learning JavaScript? Get my ebook at jshandbook.com Firebase is a mobile and web application development platform that was developed by Firebase, Inc. in 2011. It was acquired by Google in 2014 and rolled up into the Google Cloud servi... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-get-started-using-firebase-hosting-439d4bd45cb6/</link>
                <guid isPermaLink="false">66bb5a7824dd38751ddeb5d2</guid>
                
                    <category>
                        <![CDATA[ Firebase ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Flavio Copes ]]>
                </dc:creator>
                <pubDate>Thu, 08 Feb 2018 15:19:38 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*q2NlUEQNkZmI6KLvnT1tzA.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <blockquote>
<p>Interested in learning JavaScript? Get my ebook at <a target="_blank" href="https://jshandbook.com/">jshandbook.com</a></p>
</blockquote>
<p>Firebase is a mobile and web application development platform that was developed by Firebase, Inc. in 2011. It was acquired by Google in 2014 and rolled up into the Google Cloud service. Now, it’s a flagship product of the Google Cloud offering.</p>
<p>Firebase is a complex and articulated product, mainly targeted at mobile applications.</p>
<p>One of its lesser known features that we’ll discuss in this article is the Firebase advanced web hosting service.</p>
<h3 id="heading-firebase-hosting-features">Firebase Hosting Features</h3>
<p>Firebase Hosting provides hosting for static web sites, such as</p>
<ul>
<li>sites you can generate using static site generators</li>
<li>sites built with server-side CMS platforms, from which you generate a static copy of the website</li>
</ul>
<p>You can host anything as long as it’s not dynamic. A WordPress blog, for example, is almost always a good candidate to be a static site if you use Disqus or Facebook comments.</p>
<p>Firebase Hosting delivers files through the Fastly CDN, using HTTPS and provides an automatic SSL certificate, with custom domain support.</p>
<p>Its <strong>free tier is generous</strong>, with cheap plans available if you outgrow it. It’s very developer-friendly, provides a CLI interface tool, an easy deployment process, and one-click rollbacks.</p>
<h3 id="heading-why-should-you-use-firebase-hosting">Why should you use Firebase Hosting?</h3>
<p>Firebase can be a good choice to deploy static websites, and Single Page Apps.</p>
<p>I like to use Firebase Hosting mainly because I tested many different providers and Firebase offers an <strong>awesome speed</strong> across multiple geographic locations without the need for a separate CDN on top, since <strong>the CDN is built-in</strong> for free.</p>
<p>While having your own VPS is a very good option, <strong>the overhead of managing your own server</strong> for a simple website is just not worth it. I’d prefer to focus on the content rather than on the operations, just like I’d deploy an app on Heroku.</p>
<p>Firebase is even easier to setup than Heroku.</p>
<h3 id="heading-install-the-firebase-cli-tool">Install the Firebase CLI tool</h3>
<p>Install the Firebase CLI with</p>
<pre><code>npm install -g firebase-tools
</code></pre><p>or</p>
<pre><code>yarn <span class="hljs-built_in">global</span> add firebase-tools
</code></pre><p>Authenticate with the Google account (I’m assuming you already have a Google account) by running</p>
<pre><code>firebase login
</code></pre><h3 id="heading-create-a-project-in-firebase">Create a project in Firebase</h3>
<p>Go to <a target="_blank" href="https://console.firebase.google.com/">https://console.firebase.google.com/</a> and create a new project.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/0hzGqiYVSrZev8ogQPbGuw7yIa6K4VZWCgSq" alt="Image" width="469" height="589" loading="lazy"></p>
<p>Now within the console, run the following from the root folder of the site you’re working on:</p>
<pre><code>firebase init
</code></pre><p><img src="https://cdn-media-1.freecodecamp.org/images/l8Egdd07uOmSD9DABh0yGz2afrukibewdZWa" alt="Image" width="800" height="287" loading="lazy">
<em>firebase init</em></p>
<p>Press Space to select the “Hosting” option, then Enter to confirm your choice.</p>
<p>Now you need to choose the project you want to deploy the site to.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/6J2TVueoEKaBSPIjJz6UvpZkLNNobMfBNmU9" alt="Image" width="800" height="327" loading="lazy"></p>
<p>Choose “create a new project”.</p>
<p>Now you choose which folder contains the static version of your site. For example, <code>public</code>.</p>
<p>You’ll be asked two questions about the app configuration. Reply “<strong>No</strong>” to both of them:</p>
<ul>
<li>Configure as a single-page app (rewrite all urls to /index.html)?</li>
<li>File public/index.html already exists. Overwrite?</li>
</ul>
<p>This will prevent Firebase from adding its own default index.html file.</p>
<p>Now, you’re good to go:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/5NL3xuH0FsPqFq2whtP0QI6GL4tZIeyZLKa-" alt="Image" width="800" height="327" loading="lazy"></p>
<h3 id="heading-configure-the-site">Configure the site</h3>
<p>The Firebase CLI app created the <code>firebase.json</code> file in the root site folder.</p>
<p>In this article, I tell how to configure a simple feature in Firebase Hosting, by adding a small bit of configuration in the <code>firebase.json</code> file.</p>
<p>I want to set the Cache-Control header directive on all the site assets - images, CSS and JS files.</p>
<p>A clean <code>firebase.json</code> file contains the following:</p>
<pre><code>{   <span class="hljs-string">"hosting"</span>: {    <span class="hljs-string">"public"</span>: <span class="hljs-string">"public"</span>,     <span class="hljs-string">"ignore"</span>: [       <span class="hljs-string">"firebase.json"</span>, <span class="hljs-string">"**/.*"</span>,       <span class="hljs-string">"**/node_modules/**"</span>     ]   } }
</code></pre><p>It tells Firebase where is the site content, and which files it should ignore. Feel free to add all the folders you have, except <code>public</code>.</p>
<p>We’re going to add a new property in there, called <code>headers</code>:</p>
<pre><code>{   <span class="hljs-string">"hosting"</span>: {     <span class="hljs-string">"public"</span>: <span class="hljs-string">"public"</span>,     <span class="hljs-string">"ignore"</span>: [       <span class="hljs-string">"firebase.json"</span>,      <span class="hljs-string">"**/.*"</span>,       <span class="hljs-string">"**/node_modules/**"</span>    ],     <span class="hljs-string">"headers"</span>: [       {         <span class="hljs-string">"source"</span> : <span class="hljs-string">"**/*.@(jpg|jpeg|gif|png|css|js)"</span>,         <span class="hljs-string">"headers"</span> : [ {           <span class="hljs-string">"key"</span> : <span class="hljs-string">"Cache-Control"</span>,           <span class="hljs-string">"value"</span> : <span class="hljs-string">"max-age=1000000"</span> <span class="hljs-comment">//1 week+         } ]       }     ]   } }</span>
</code></pre><p>As you can see, we tell that for all files ending with <code>jpg|jpeg|gif|png|css|js</code> Firebase should apply the <code>Cache-Control:max-age=1000000</code> directive, which means that all assets are cached for more than 1 week.</p>
<h3 id="heading-publish-the-site">Publish the site</h3>
<p>When you are ready to publish the site, you just run the following command and Firebase will take care of everything.</p>
<pre><code>firebase deploy
</code></pre><p>You can now open <a target="_blank" href="https://yourproject.firebaseapp.com/">https://yourproject.firebaseapp.com</a> and you should see the website running.</p>
<h3 id="heading-custom-domain">Custom Domain</h3>
<p>The next logical step is to make your site use a custom domain.</p>
<p>Go to <a target="_blank" href="https://console.firebase.google.com/project/_/hosting/main">https://console.firebase.google.com/project/_/hosting/main</a> and click the “Connect Domain” button:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/OktJ0asSC0uVphJs2HCoqYIrz3FvRD7yKKRA" alt="Image" width="800" height="338" loading="lazy"></p>
<p>The wizard will ask you for the domain name, then it will provide a TXT record you need to add to your hosting DNS panel to verify the domain.</p>
<p>If the domain is brand new, it might take some time before you can pass this step.</p>
<p>Once this is done, the interface will give you two <strong>A records</strong> to add as well to your hosting DNS panel.</p>
<p>If you set up <code>yourdomain.com</code>, don’t forget to also set up <code>www.yourdomain.com</code> by making it a redirect.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/GCq9sjxSfJ1Jvw1JsZAVLjlF2EnJS213a4IH" alt="Image" width="750" height="519" loading="lazy"></p>
<p>Now you just have to wait for your hosting to update the DNS records and for DNS caches to flush.</p>
<p>Also, keep in mind that your SSL certificate is automatically provisioned but requires a bit of time to be valid.</p>
<blockquote>
<p>Interested in learning JavaScript? Get my ebook at <a target="_blank" href="https://jshandbook.com/">jshandbook.com</a></p>
</blockquote>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
