Hello There, Hope you are goind great. Today I am gona discuss how to host a jekyll’s blog website on aws and write an new blog post by simply using the git protocol. Here we go:
Create a new machine on aws
You have to create a new machine on aws or may be use existing one. For more detail on creating new machine on aws click here.
Setup for blog site:
- Install rvm and ruby and bundler.
- Install jekyll by running
gem install jekyll.
- Install git by running
sudo apt-get install git.
- Install dependencies
sudo apt-get install git nodejs ruby ruby1.9.1-dev npm apache2.
- Change permissions
sudo chown -R USER_NAME:USER_NAME /var/www/html.
- Create a bare repository
mkdir blog.git && cd blog.git && git init --bare
- Create a post receive hook. For this run commands.
cp hooks/post-receive.sample hooks/post-receive
- Write following lines of code inside
- Change permission for execution
chmod +x post-receive.
Setup on local machine to write posts:
- Go inside your jekyll blog site’s repository then run the following commands:
git remote add origin USER_NAME_OF_AWS_MACHINE@IP_OF_AWS_MACHINE:/home/USER_NAME/blog.git.
- Add your files by running
git add .. You can also use git ignore to manage the unwanted files to be pushed to the server.
- Commit you changes
git commit -m 'YOUR COMMIT MESSAGE'.
- Pushing to the server
git push origin master.
Writing new blogs
- For writing new blogs you just make a new file inside the posts folder of your blog site and perform
git commit and pushto pushing your changes to the server.
- Now go to open
http://IP_OF_AWS_MACHINEand you can see your site is live on aws.