Technologies used in this blog

So, let’s talk about the technologies used in this blog, just for reference.

Server

The blog is hosted on a DigitalOcean droplet,$5/month,1GB RAM,25GB SSD. I have only used AWS and Digital Ocean before, and apparently, Digital Ocean is the cheaper one. I’ve once also thought about switching to Linode. At that time, DO only got 512MB RAM, so I often run into situations that my programs get killed due to insufficient memory, which was pretty annoying. But just when I was about to pull the trigger, Digital Ocean decided to increase their RAM, so that’s the end of it.

Continue reading Technologies used in this blog

seewang.me now served over HTTP2

You surely have heard HTTP2 and its advantage over the good old HTTP1.1, security, performance blah blah blah…
And it bizarrely easy to enable on my Nginx.

Firstly some requirements:

Nginx > 1.9.5
OpenSSL > 1.0.2

Then add http2 to the server configuration, after listen 443 ssl.

server {
    listen 80;
    server_name seewang.me www.seewang.me;
    return 301 https://seewang.me$request_uri;
}
server {
    listen 443 ssl http2;
    server_name seewang.me www.seewang.me;

    #rest of config...
}

And that’s it, now we can check it on Chrome Developer Tools > Network tab, we’ll need to right click on the column header and check Protocol column.

Chrome Developer Tools

Free SSL Certificate, Let’s Encrypt

When I first launched this blog, I set up an SSL certificate from StartCom. It was an okay experience to use, other than I had to renew it via their site every year. But a couple of days ago, Chrome prompted SSL errors when I visited the blog and refused to recognise the certificate even after I renewed it. A quick Google search tells that StartCom got themselves banned by Chrome and Firefox.

So I went on looking for new certificate provider and apparently Let’s Encrypt is the best call right now.

Differ from StartCom, Let’s Encrypt has a program can be run directly on the server to get a certificate and auto-configure HTTPS (didn’t work though), which is much easier.

According to the doc, all I had to do was just downloading and then running.

    wget https://dl.eff.org/certbot-auto
    chmod a+x certbot-auto
    ./certbot-auto

Unfortunately, it doesn’t recognise my Nginx settings, so I had to get certificate firstly and configure it myself manually

    ./certbot-auto certonly

During the run it will promote to let you enter the domain name and the root of web server etc., you can refer the official site(https://letsencrypt.org/) for detail. But in general, it was pretty easy and nice.

Linux Note 1: Command Types and Frequently Used Commands

Internal Command and External Command

Internal Command is a part of the Shell program, it consists of some simple Linux system command, which will be recognized by the Shell program and executed within the Shell program. Usually, Shell gets loaded into memory when a Linux system startup.

Internal Command is written within bash’s source code, so it run faster than external command as interpreting an internal command does not need to create a new child thread. Some of most common internal command includes exit, history, cd, echo etc.

On the other hand, external commands usually are the functional programs in Linux operating system. While having powerful functionality, external commands usually also mean big and complex programs. Therefore, they are not loaded on Linux startup but are loaded on use.

Usually instances of external command are not included in Shell, but they let Shell control the progress of the program execution. They are usually stored under /bin, /usr/bin, /sbin, /usr/sbin etc.

type command can be used to distinguish internal and external commands.

type cd  
cd is a shell builtin
type -a ls
ls is aliased to `ls --color=tty'
ls is /bin/ls

It is clear to see, cd is an internal command while ls is an external command.

Frequently Used Commands

ls: list

cd: change directory

~: change to home directory, same as using cd without an argument.
~[USERNAME]: change to the home directory of given user
-:change to the last directory

type: print the type of commands
man: mannual
info: online documentation
/usr/share/doc: documentation

date: date
cal: calendar

Vim command

SPACE: next screen
ENTER: next line
k: previous screen
b: previous line

/keyword: search
?keyword: search previous
n: next match
N: preious match