How to deploy Jekyll site to Heroku?
13 Feb 2022 - Gengar
In this article, I will introduce how to deploy Jekyll site to Heroku.
I assume your Jekyll site is ready. Here are few steps to follow:
-
Create a Heroku account
-
Install the Heroku CLI
-
Go to command prompt, log in to your Heroku account and follow the prompts to create a new SSH public key
$ heroku login
-
Create a new Heroku app with unique name
$ heroku create myuniqueappname
or let Heroku choose for you
$ heroku create
-
Add a file named “Procfile” in your Jekyll project root folder with the following content:
web: jekyll serve -P $PORT --no-watch --host 0.0.0.0
Heroku will run this command on your dyno
-P $PORT
: your server will be run on$PORT
which is determined by Heroku--no-watch
: don’t watch source folder for changes and re-builds--host 0.0.0.0
: run your server on Heroku’s localhost - Initialize a git repository in your project directory
$ cd my-project/ $ git init $ heroku git:remote -a my-project
- Deploy your application
$ git add . $ git commit -am "make it better" $ git push heroku master
- That’s it, use “
heroku open
” to go to your site and enjoy it.