Skip to content
Source code and backup of my personal website & blog
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Clone the respository on your server at a location (lets call it ~root) by doing,

git clone

You can also fork the repository first and then clone it so that you can push the changes back again and hence use GitHub as a backup for the entire server.

Static file server

Install Nginx,

sudo apt-get install nginx # ubuntu
sudo pacman -S nginx # arch
sudo yum install nginx # rhel/centos

Edit your Nginx.conf file to look like this,

worker_processes  1;
user ~username ~group;
events {
    worker_connections  1024;
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen 80;
        server_name ~servername;
        location / {
            root   ~root/blog;
            index  index.html index.htm;

    location /post-comment {
        proxy_pass http://localhost:8333;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    error_page   500 502 503 504  /50x.html;
        location = /50x.html {
        root ~root/error;

    error_page 404 /404.html;
    location = /404.html {
        root ~root/error;

    error_page 403 /403.html;
    location = /403.html {
        root ~root/error;

Start/Restart your Nginx server,

sudo systemctl restart nginx

Enabling Comments

Now we have to install and start the nodejs comment server,

sudo pacman -S nodejs npm
sudo npm install -g pm2
pm2 start ~root/server/post-comment.js

Management Scripts

Finally symlink the indexing and visitor count scripts,

sudo ln -s ~root/tools/create-index /usr/bin/create-index
sudo ln -s ~root/tools/visitors /usr/bin/visitors

Make sure the line 3 and 20 in the create-index file is edited to show the root folder of your server.

That's it! Your blog should be up and running now. It will be the exact replica of mine with all the content :/ so delete away the stuff you don't need and customise away!

Use the existing files as templates and create new html files in the ~root/blog/posts folder, then run create-index on shell to create the index.json file. You can see the visitor numbers by running visitors on shell. The ~root/blog/feed.xml file needs to be edited by hand.

Preserving Older Logs

By default, nginx logs older than a month are deleted. You may have to ajust the logrotate settings for these to be retained longer periods of time.

The /etc/logrotate.d/nginx file needs to be edited to be,

/var/log/nginx/*log {
	rotate 300
	create 640 http log
		test ! -r /run/ || kill -USR1 `cat /run/`

Then load the file into logrotate by doing,

sudo logrotate /etc/logrotate.d/nginx

Now logrotate will retain 300 weeks worth of data before it starts to delete old logs.

You can’t perform that action at this time.