Skip to content

Instantly share code, notes, and snippets.

@scorchio
Forked from wh1tney/deploy-static-site-heroku.md
Last active August 31, 2017 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scorchio/8e653592ccc515e2cf00cf17275e4d3e to your computer and use it in GitHub Desktop.
Save scorchio/8e653592ccc515e2cf00cf17275e4d3e to your computer and use it in GitHub Desktop.
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This tutorial will teach you how.

Basic Assumptions

  • You want to deploy some straight-up HTML, CSS, JS, maybe a few images. Nothing fancy here.
  • You are in the root directory of your site (i.e. the directory that contains all subdirectories and files for the site)
  • The root directory contains a main HTML page, e.g. index.html
  • A Heroku app and remote are set up and ready to go

Steps

  1. Add a file called composer.json to the root directory by running touch composer.json.
  2. In composer.json, add the following line: {}.
  3. Add and commit all the files (including the new composer.json, then git push heroku master.

Done! Visit your deployed static website, hosted by Heroku (as a fake PHP app ☺).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment