Notes
Structure
So, I figured out, that with a little php, and some of the new html5 tags it’s pretty easy to serve up dynamic content. Each page you see, is a directory with an index.php, which scans a docs folder for markdown documents which it adds to the posts list on the left.
The root page has exactly the same thing.
HTML 5
The new capabilities of nav tags and structural elements like header and footer tags are great!
Server Issues
I am using an AWS Lightsail instance with an Nginx stack. I’m learning, but I was having some problems with the configuration. More or less, it comes down to the hierarchy of virtual servers.
The default connection method is declared with default_server
in the listen
directive. The complications come from the fact that there are two different connection methods: http and https. Ideally, a connection would use https, but if a client requests http you don’t necessarily want to just ignore them. So, the default_server
needs to be https, and requests to http need to be redirected to https. The basic upshot, is that the listen
directive in the server_blocks
needs to listen on port 443, and then in nginx.conf
port 80 needs to return 301 and the same url at https://
I’m still learning how to configure Nginx properly. The latest thing I began looking into, was how to prevent access to resources in the server root. Technically, a client can request any file in that or a sub-directory, and right now they would get it. That’s not really a big deal with what is there, but what if it was? How do you properly configure a whitelist for URLs? I know it will involve the location
directive, but properly crafting an efficient matching pattern is a little confusing. That is to say, I could deny all, and then add back a location
for each project page, but there should be a pattern to match all sub-directories.
Merits of PHP
- Quick and easy. That is a value, but the quirks!
str_compare
… returns0
if the strings match! For the love of God, why? Well, the why is because it is attempting to provide more information that just simple matching. One could argue it was an ill-advised attempt, but that’s why.
django
I am experimenting with django on a sub-domain. There are things I am still learning, and django is not the best solution for the format you are currently seeing, but for a larger, more structured project it has some real advantages.