How I Built This

13 September 2020

This document attempts to capture the various bits of configuration I went through to get this site into the state it’s currently in.

Server Space

My server is maintained by NearlyFreeSpeech. They do “pay as you go” hosting, meaning that each served request, email sent, or DB query, costs you a certain amount. This works well for me, since I’m sure that for a long time I’m going to have very minimal traffic. An advantage of NFS for me is that they’re very well documented, and while you could in principle just use the FAQ and then go to any provider you like, I think it’s only fair to reward them for this service.

HTTP Server

This site is built with Apache in mind, but for portability I think that the dependence on HTTP server should be minimal and explicit. Currently, .htaccess (which is the only Apache-specific feature) is used to do two things:

The site will function without these pieces of functionality. This is particularly important for local testing - if you want to run up the stack to check that some CSS change works as you expect, you don’t have to have an Apache daemon running to serve it. You can instead use something lightweight like http.server.

For links to work, it is important that all relative paths on the site point to filenames and not the pretty URLs. So you should link to /notes/website-documentation.html, and not /notes/website-documentation.

Source Code

The full source for this site, including the Markdown source for any of the articles compiled into the site, is freely available on GitHub. I use GitHub currently out of intertia, and at some point will probably switch to a self-hosted Git server. For further details, check out the README.

DNS

I bought this domain through GoDaddy, and my DNS is managed by NearlyFreeSpeech. I think I was required to use NFS, but I can’t remember why.

There is a privacy concern here. When you register a domain name, you must provide an email address and your real address. By default, these are publicly visible in WHOIS records. Your domain provider may be more conscientious than that, though, and redact some of this information. For example, GoDaddy redacts my email address, but keeps my approximate location:

$ whois danielittlewood.xyz
Registrar: Go Daddy, LLC
Registrar IANA ID: 146
Registrant Organization:
Registrant State/Province: London
Registrant Country: GB
Registrant Email: Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
Admin Email: Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
Tech Email: Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
Registrar Abuse Contact Email: abuse@godaddy.com
Registrar Abuse Contact Phone: +1.4805058800

You can pay money to get even more privacy, for example RespectMyPrivacy (from NearlyFreeSpeech) will give you completely anonymous forwarding details. This site isn’t really anonymous (my name is all over it), so I’m not going to bother switching at this time.

Email Forwarding

If you want to get in touch with me, the address admin@danielittlewood.xyz at the top of the page will be forwarded to my personal email. I’ve done this to avoid getting inundated with spam, or by opportunistic robots trying to check which services I’m subscribed to. Gmail has a feature which lets you direct dummy accounts to a single inbox, but that ties you into their service (whereas I can use any private email provider I like with this setup).

HTTPS

For information about getting a certificate for HTTPS, visit Let’s Encrypt. The usual situation is that they will give you a “challenge” file which you must put onto your server to prove you own it. My provider has an automatic script which sets up TLS for you, and it is run automatically.

Meta Tags and Templating

Site-wide meta tags are built into pages automatically. This is done using pandoc’s templating feature. There are several “ways in” to using pandoc templates to set metadata variables. To see their default HTML template, run pandoc -D html, and find examples in this site’s source code in the Makefile, as well as in the notes directory.

Pandoc’s markdown-in-html-blocks extension allows for convenient inclusion of html features not native to markdown. For example, you can use the HTML5 <details> tag like so:

<details>
<summary> This section contains [Markdown] syntax. </summary>
## Examples
You can use all the features of Markdown you like in here.
</details>

See the source for more examples.

Security Headers

Check out Security Headers to see if your site has appropriate headers set. There are a variety of ways to set them, and I think it’s a property of your HTTP server. Mine is Apache, so I configure it with .htaccess. Check out the source to see how mine is set up.