Alternatif Enerji Ne Zaman Geleneksel Enerji Olacak?

Yenilenebilir enerjinin günümüzde ne kadar önemli bir yere sahip olduğu gerçeğine hepimiz vakıfız. Kaynağının sınırsız ve temiz olması ve ülkeler arası ilişkilerde yeni dengeler oluşturma potansiyeli…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Setting up a free Ghost blog on Google Cloud Platform and Cloudflare

Here’s the general structure of what we’ll setup:

Fig 1. highly professional artwork

To setup the server first we’ll go into the Google Cloud Platform console and create a new VM instance with the latest Ubuntu LTS version, at the time of this writing I chose ubuntu 18.04 LTS minimal. We’ll also want to create it in a free region, the closest free region to me was us-east 1 (South Carolina) and I chose zone us-east1-b. I allocated 10gb of disk space to it (default) along with allowing HTTPS access through the Google Cloud Platform VPC firewall

If you do all of the above.. in theory you shouldn’t be charged ! You also get $300 of free credit for 12 months just to mess around on the platform so give it a shot, in the worst case you’ll just use up some of that credit if you make a mistake.

After you create the server you can login to it by editing it + going to the SSH keys page under VM isntances -> instance details -> edit -> SSH Keys:

I’m paranoid so I blocked my info out

Let’s add a new user called “ghostuser”, we’ll use that later to run the ghost service under:

Next we’ll update the ubuntu’s package manager and upgrade the system with the latest versions of things:

Next we’ll install nginx and mysql-server since they’ll be used by ghost internally:

Now we’ll setup mysql, let’s choose some suitably secret password here:

Now we’ll setup nodejs, again it’s used by ghost internally:

And finally we’ll install the ghost cli as a global package through npm:

Ok! Now let’s actually install ghost, let’s create a directory for it with the correct permissions:

Okay.. NOW! Since we’re using a terrible f1 micro instance with 0.6gb memory, let’s install some swap space before we run the install. The below commands will create a 1gb swap file on the disk, setup the correct permissions, activate it and add it to /etc/fstab to automount on reboot:

Ok.. now let’s install the ghost software itself, if you’re feeling brave go ahead and run the following to start the install. Note the no-check-mem flag since our instance sucks:

When we run the install, let’s give it some subdomain that we’ll put on our Cloudflare DNS, like blog.xxx.com, in this case I’ll use blog.christianwilkie.com. I let the Ghost CLI handle setting up MySQL DB, partially setting up nginx (we’ll revisit it), but did NOT let it handle setting up HTTPS/SSL. Instead of using a let’s encrypt cert we’ll let Cloudflare handle the SSL:

Why let Cloudflare handle the SSL? Our server sucks and Cloudflare might help relieve some of the load a bit with caching. Well that’s my hope anyway. Caching stuff is not really my area of expertise.

Anyway, now that Ghost is setup let’s go over to cloudflare and setup that subdomain, point it on over to the external IP of your VM you’ve been working on:

It should propagate in a min or two:

Also you’ll notice this IP is actually part of Cloudflare’s network, and not the IP of the server itself:

Make sure the SSL mode is set to “Full”,

Honestly out of laziness and the fact that I trust cloudflare enough I recommend letting Cloudflare generate the private key/CSR for you. Leave the hostnames as the apex domain (example.com) and the wildcard domain (*.example.com). And set the certificate expiration as 15 years because why not. If you’re reading this you’re probably not hosting anything important enough to worry about rotating the private keys honestly, so go ahead and click that 15 year validity period:

Once you click next you’ll get two files: a private key and a certificate. The certificate can be considered “public information”, the “private key” you should save in a very safe spot depending on your paranoia level and never let anyone see it. Only our nginx server needs it, that’s it, no one else. Let’s go back into our SSH session to our VM and copy those files to your server. You might need to install nano/whatever editor of your choice:

Let’s install the CERTIFICATE first — make sure it says this at the top:

To do so we’ll install it in ubuntu under /etc/ssl/certs:

Paste in the contents of your Cloudflare certificate into that file then save it. Next we’ll update the PRIVATE KEY. It should say this at the top:

Private keys secured differently on the system since you don’t want random people accessing them in a shared server environment, so they’re under /etc/ssl/private. Let’s install it there:

Ok. Now our Cloudflare certificate/private key is installed. Now what? Almost done really, just need to fix our nginx configuration and start up ghost. Let’s go check out our nginx config file. Nginx stores its site specific files under /etc/nginx/sites-available along with symlinks in the /etc/nginx/sites-enabled directory to those files to enable/activate them. The Ghost CLI earlier should have setup one for us earlier without an SSL server block, let’s check it out:

Let’s modify it to be something like this..

Now that we have nginx setup, ghost is setup, cloudflare is setup.. if all goes well we can start ghost and maybe everything will work ! hopefully !

Let’s check the status with ghost ls:

Hooray! (hopefully). Let’s go to our domain..

it worked! Let’s go back to our original diagram..

Looks good! Our connection is encrypted via SSL, our blog is running and should be able to handle a couple users.. but probably not too many more than that

Things not covered: backing up our server, updating/patching our linux VM, updating ghost itself.. now doesn’t the $/month seem like a bargain for having the Ghost team patch/update all of your stuff for you?

But either way — good luck and happy blogging! I think I’ll take down my test Ghost blog soon and stick with medium for now since I’m lazy

Add a comment

Related posts:

Reflectie week 6

Deze week heb ik geleerd voor het tentamen en zijn we voor het Ketelhuis weer een flink stuk opgeschoten. Het boek is eigenlijk best goed te doen dus ik denk dat het tentamen ook niet al te lastig…

The Last Generation of Uighurs

These are satellite images from the deserts of Western China. Look closely, and you’ll see these huge complexes being built. From the sky, they sort of look like factories or even schools. This…

Manoj Malviya Ips Biography

For the individuals who don’t watch Manoj Malviya Ips normally, it tends to be difficult to stay aware of the entirety of the Manoj Malviya Ips life stories. This article is intended to get you…