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.
- 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
- Add a file called composer.json to the root directory by running
touch composer.json
. - In composer.json, add the following line:
{}
. - 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 ☺).