How to deploy static website to Heroku
In my previous articles, I showed you some free services/platforms to deploy your static websites. So in this article, I am showing you how to deploy a static website to Heroku for free.
What is Heroku is?
Heroku is a hosting platform where you can deploy dynamic applications in Rails, PHP, Node.js and Python. If you don’t want to pay for cloud storage and don’t mind your site being ‘asleep’ during inactive hours, Heroku is a great platform for demo-ing your projects online
Prerequisites
* GitHub Account
Before Starting make sure that you have a GitHub account. If not, you can simply obtain a GitHub account from here.
* Git installed, and configured on your machine
Git is a version controlling system that tracks each and every change you did you to files in a project. It keeps records on what the changes were did to files (what was added? what was removed), who made the changes, notes and comments about the changes by the changer and also it keeps records on the time which the changes happened.
* Heroku account and Heroku CLI installed, and configured on your machine
If you haven't a Heroku account, you can obtain a account from here. To install install Heroku CLI on your machine follow the steps given here.
Deploying your site
1 | mv index.html home.html |
Then we’ll use the command line tool called git to initialize or create a version of the site you want to deploy. To do that run the command:
1 | git init |
1 | git commit -m "My site ready for deployment." |
1 | heroku apps:create animated-bulb |
If you are not already logged run below command in your terminal
1 | Heroku login |
1 | git push heroku master |
Conclusion
You can now visit your site at https://whatever-name-you-selected.herokuapp.com/
and you can see my example site here.
All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.
Comments
GitalkDisqus