Upgrading my blog

Today I started moving my blog to NextJS. Both new and old blog posts will be migrated here as time lets.

I have adopted the template from GitHub

Please be gentle - I am learning ...

The old posts are taken from at WordPress database dump ;-)

As the NextJS framework is served ny e NodeJS server, I need to have that automatically started. I guess the standard says PM2. So I have installed that npm install pm2 -g and added the "build" of my NextJS blog.

1pm2 start npm --name veloce -- run serve
2pm2 save

In order for systemdto start pm2 on boot:

1$ pm2 startup
2[PM2] You have to run this command as root. Execute the following command:
3      sudo su -c "env PATH=$PATH:/home/unitech/.nvm/versions/node/v14.3/bin pm2 startup <distribution> -u <user> --hp <home-path>

My nginxneed to forward trafic to the port that NodeJS exposes my blog on:

 1server {
 2    listen 443 ssl http2;
 3    listen [::]:443 ssl http2;
 4    server_name veloce.dk;
 6    ssl_certificate /etc/letsencrypt/live/veloce.dk/fullchain.pem;
 7    ssl_certificate_key /etc/letsencrypt/live/veloce.dk/privkey.pem;
 8    include /etc/letsencrypt/options-ssl-nginx.conf;
 9    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
10    add_header Strict-Transport-Security "max-age=31536000" always;
11    ssl_trusted_certificate /etc/letsencrypt/live/veloce.dk/chain.pem;
12    ssl_stapling on;
13    ssl_stapling_verify on;
15    # Security / XSS Mitigation Headers
16    add_header X-Frame-Options "SAMEORIGIN";
17    add_header X-XSS-Protection "1; mode=block";
18    add_header X-Content-Type-Options "nosniff";
20    location / {
21        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
22        proxy_set_header Host $host;
23        proxy_pass;
24        proxy_http_version 1.1;
25        proxy_set_header Upgrade $http_upgrade;
26        proxy_set_header Connection "upgrade";
27    }