Self hosting

2019-04-29

It looks like this 200 words a day site doesn't support any mono spaced fonts, which is rather annoying as I wanted to write some posts with code snippets in. So I need to host my posts elsewhere. I don't want anything fancy just to be able to write my 200 words in markdown and have them look some what presentable. I already had a VPS lying around so I thought I'd go for the most MVP solution possible, a script to build html pages out of markdown, a script to copy these to my VPS, and nginx just serving a static directory. I could have looked into something like middleman or jekyll but it's just as simple to do this yourself if you know a bit of Ruby and how to serve files, plus this is more fun. The whole set up took under an hour to get working.

Here's my setup

.
├── bin
│   ├── html
│   └── publish
├── done
│   └── 2019-04-28.md
├── draft
│   ├── 2019-04-29.md
│   ├── cardio
│   └── ideas
├── nginx.conf
├── public
│   ├── 2019-04-28.html
│   └── sakura.min.css
└── sakura.css

4 directories, 10 files

./bin has two scripts html, which handles converting all the markdown files in ./done to html and writing them to the public directory, and publish, which copies the files to my server.

Then I have a super simple nginx config file that serves everything in the public directory.

server {
  listen *:80;
  server_name 200words.rjldev.com;

  root /var/www/200words/public;
  autoindex on;
}

The nice thing about just serving the whole directory is that I don't need to even bother writing an index page, nginx gives a list of all files in the directory.

Anyway that's about 200 words, I'll probably go into more detail on the scripts in another post.