Setting up ghost on glitch/gomix/hyperdev/whateverfogcreekcallsitnowadays and binding it to a custom domain, through apache2

Apparently Gomix got renamed to Glitch. After it got renamed from hyperdev. Confused? So am I.

Nevermind. The service is basically a great host for tiny webapps, by fog creek software. You know, those guys. Like uh, the one that was previously led by Joel Spolsky.

Meh, back to topic. On glitch, other than the regular frontend stuff, you can write nodejs apps too! (and fork stuff others make). You know what else uses nodejs? Ghost. The blog system I use. This thing. It's not on Glitch, though. But honestly, it's HELL to set it up properly, like for it to be started on startup etc too, or to update it. That's why I've chosen to just do it through glitch for Ayyuce (more on her later).

So I tried to fork on main page but failed, so I went to https://glitch.com/edit/#!/project/ghost and hit this tempting Remix this button:

And it actually forked it this time. Coolio. First one I made was boom-eggplant.glitch.me, the blog of ayyuce demirbas. I first forwarded it to blog.ayyucedemirbas.com and then decided to share my experiences so everyone can easily get a ghost blog.

The one I just made was narrow-frame.glitch.me. So meh, let's get in already!

Let's first open /ghost (https://narrow-frame.glitch.me/ghost) and set up the main user. It's simple enough, do it on your own :)

After that's out of the way, click to Navigation on sidebar.

Now, I couldn't find a way to change the config and set the actual URL, but thankfully ghost uses relative URLs instead of absolute ones, so it shouldn't cause too much issues.

So, blabber aside, set the home link to the place the blog will be on.

And hit save, ofc.

After that's out of the way, let's get to the fun part. First, configure the subdomain you allocated to point to your server. This depends on your DNS provider. BRB doing cloudflare magic (self note: move away from cloudflare already). Also get SSL certs while at it. Check out letsencrypt.org and cloudflare.com if you need one.

There.

Now let's configure apache.

First run sudo a2enmod proxy proxy_http proxy ssl. After that's done, run sudo apachectl graceful to restart apache gracefully.

EDIT: 4:03 AM, 16th of March, 2017: Added proxy_http as that's needed too.

Now, let's navigate to our config directory and edit our config file to enable our blog, shall we? Just... go to where that folder is on your PC. It's on /etc/apache2/sites-enabled/ on Ubuntu.

After that, add this:

<VirtualHost *:80>  
        ServerName the_site_name_you_set_before
        ServerAlias www.the_site_name_you_set_before
        Redirect permanent / https://the_site_name_you_set_before/
</VirtualHost>  
<VirtualHost *:443>  
    ServerName the_site_name_you_set_before
    ServerAlias www.the_site_name_you_set_before

    SSLEngine on
    SSLCertificateFile sslcertfilelocation
    SSLCertificateKeyFile sslkeyfilelocation
    SSLProxyEngine On
    SSLProxyVerify none
    SSLProxyCheckPeerCN off
    SSLProxyCheckPeerName off
    SSLProxyCheckPeerExpire off
    <Proxy *>
         Require all granted
    </Proxy>

    ProxyPreserveHost off
    ProxyRequests off
    ProxyPass / https://glitch_link/
    ProxyPassReverse / https://glitch_link/
</VirtualHost>  

Replace the_site_name_you_set_before with your site's domain (theotherblog.ave.zone for me), sslcertfilelocation and sslkeyfilelocation with locations of the SSL certificates you obtained, and glitch_link with the blog's link on glitch (narrow-frame.glitch.me for me).

Now, if you opened this page because you set it up yourself and all your see is "everything is fine" message, the important bit is "ProxyPreserveHost off". Thank me later :)

Ok, if you're done configuring the config file, save it, and run apachectl graceful. If you didn't misconfigure anything, the blog should be accessible on that site.

And yeah, mine is.

Hope you liked this post! Isuckatendingblogpostssendhelp.

Avery (Arda) Özkal

Some kind of developer. Cares about FOSS, privacy, gender equality and stuff. Likes gaming. Blogs occasionally.

Ankara, Turkey https://ave.zone

Subscribe to ao's blog

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!