Skip to main content

Static Site Deployment: Free Hosting Guide

Guide about Static Site Deployment: Free Hosting Guide

Written by Mayank Baswal

Founder of is-cool-me · DNS & Platform Infrastructure

Mayank Baswal maintains the is-cool-me platform and writes technical guides focused on DNS configuration, subdomain infrastructure, SSL troubleshooting, deployment workflows, and platform reliability.

Reviewed by is-cool-me Technical Review
## Introduction Static site deployment is a crucial aspect of web development, allowing developers to host their websites on a server without the need for a database or dynamic content generation. This approach has gained popularity in recent years due to its simplicity, security, and performance benefits. As a developer on the is-cool-me platform, you can take advantage of free hosting for your static sites on subdomains like myproject.is-pro.dev. In this guide, we will walk you through the process of deploying your static site, exploring the benefits, and providing a comprehensive overview of the configuration options, common pitfalls, and best practices. The motivation behind this topic is to empower developers with the knowledge and skills to deploy their static sites efficiently and effectively. By the end of this guide, you will be able to deploy your static site on myproject.is-pro.dev, troubleshoot common issues, and optimize your site for performance and security. The importance of static site deployment lies in its ability to provide a fast, secure, and scalable solution for hosting websites, making it an attractive option for developers and businesses alike. ## Prerequisites Before you start deploying your static site, you need to have a few prerequisites in place. First, you should have a basic understanding of web development, including HTML, CSS, and JavaScript. You should also have a code editor or IDE of your choice, such as Visual Studio Code or Sublime Text. Additionally, you need to have a GitHub account, as we will be using GitHub Pages for deployment. If you haven't already, create a new repository for your project and initialize it with a README file. You should also have Node.js and npm installed on your machine, as we will be using them to install dependencies and build our site. It's also essential to have a basic understanding of the command line interface (CLI) and how to navigate through directories and files. Familiarity with Git and version control is also necessary, as we will be using Git to push our code to GitHub and deploy our site. If you're new to these concepts, don't worry; we will provide a step-by-step guide to help you get started. ## Step-by-step instructions Here's a step-by-step guide to deploying your static site on myproject.is-pro.dev: 1. **Create a new repository on GitHub**: Log in to your GitHub account and create a new repository for your project. Initialize it with a README file and add a .gitignore file to ignore unnecessary files. 2. **Install dependencies**: Open your terminal and navigate to your project directory. Run the command `npm init` to create a package.json file, and then install the necessary dependencies using `npm install`. 3. **Build your site**: Use a static site generator like Jekyll or Hugo to build your site. For example, if you're using Jekyll, run the command `jekyll build` to generate your site's HTML files. 4. **Configure GitHub Pages**: Create a new branch on your repository, and name it `gh-pages`. This branch will be used to deploy your site to GitHub Pages. 5. **Push your code to GitHub**: Use the command `git add .` to stage all changes, and then commit your changes using `git commit -m "Initial commit"`. Finally, push your code to GitHub using `git push origin gh-pages`. 6. **Configure your DNS**: Update your DNS settings to point to GitHub's servers. You can do this by adding a CNAME record to your DNS settings, pointing to `myproject.is-pro.dev`. 7. **Verify your deployment**: Once your DNS settings have propagated, verify that your site is live by visiting `http://myproject.is-pro.dev` in your browser. Here's an example of how to use the `jekyll build` command to build your site: ```bash jekyll build --source ./src --destination ./build ``` This command tells Jekyll to build your site using the source files in the `src` directory and output the generated HTML files to the `build` directory. ## Configuration deep-dive Let's take a closer look at the configuration options available for deploying your static site on myproject.is-pro.dev. One of the most important configuration options is the `CNAME` record, which tells GitHub which domain to use for your site. For example, if you want to deploy your site to `api.myproject.is-pro.dev`, you would add a `CNAME` record with the value `api.myproject.is-pro.dev`. Here are some other configuration options to consider: * **Repository settings**: Make sure your repository is set to public, and that you have enabled GitHub Pages. * **Branch settings**: Ensure that your `gh-pages` branch is set as the default branch for your repository. * **DNS settings**: Update your DNS settings to point to GitHub's servers, using a `CNAME` record or an `A` record. Here's an example of how to configure your `CNAME` record: ```bash cat > CNAME < ``` This code snippet adds Google Analytics to your site, allowing you to track your site's performance and visitor behavior. ## Troubleshooting section If you're experiencing issues with your deployment, here are some troubleshooting steps to help you diagnose and fix the problem: 1. **Check your build logs**: Verify that your build was successful, and that there are no errors in your build logs. 2. **Check your repository settings**: Ensure that your repository is set to public, and that you have enabled GitHub Pages. 3. **Check your DNS settings**: Update your DNS settings to point to GitHub's servers, using a `CNAME` record or an `A` record. 4. **Check your branch settings**: Ensure that your `gh-pages` branch is set as the default branch for your repository. 5. **Check your site's configuration**: Verify that your site's configuration is correct, and that you're using the correct `CNAME` record. Here's an example of how to troubleshoot a deployment failure: ```bash git status git log ``` These commands help you diagnose any issues with your deployment, by displaying the status of your repository and the commit history. ## Deployment scenario from operations Let's take a look at a real-world example of deploying a static site on myproject.is-pro.dev. Suppose we have a website called `myproject` that we want to deploy to `http://myproject.is-pro.dev`. We would follow these steps: 1. **Create a new repository on GitHub**: We create a new repository on GitHub called `myproject`, and initialize it with a README file. 2. **Install dependencies**: We install the necessary dependencies using `npm install`. 3. **Build our site**: We use a static site generator like Jekyll to build our site, using the command `jekyll build`. 4. **Configure GitHub Pages**: We create a new branch on our repository, and name it `gh-pages`. We then configure GitHub Pages to use this branch. 5. **Push our code to GitHub**: We push our code to GitHub using `git push origin gh-pages`. 6. **Configure our DNS**: We update our DNS settings to point to GitHub's servers, using a `CNAME` record. 7. **Verify our deployment**: We verify that our site is live by visiting `http://myproject.is-pro.dev` in our browser. Here's an example of how to configure our `CNAME` record: ```bash cat > CNAME <
Share this article Share on X Share on LinkedIn

Explore More