Skip to content

Hosting on your domain with HTTPS

pluja edited this page Apr 29, 2024 · 4 revisions

How to Host Blogo on Your Domain Using Caddy and Docker

This guide will show you how to use Caddy as a web server to host Blogo on a domain of your choice with automatic HTTPS. Before you begin, make sure you have the following:

Note

Since blogo is very lightweight, you can run it on a very cheap server.

Step 1: Configure Your Domain

First, point your domain to the IP address of your server. This is necessary for generating an SSL certificate automatically via Caddy.

Type Host Value
A (SUB)DOMAIN IP_ADDRESS

This is an example DNS record. The host value should be set to either the root domain or a sub-domain. The value should be the IP address of your server.

Step 2: Prepare the Environment

Create a directory on your server to store Blogo's compose file and articles folder. Then, navigate into this directory and create a docker-compose.yml file with the following content:

services:
  caddy:
    image: lucaslorentz/caddy-docker-proxy:latest
    container_name: caddy
    ports:
      - "80:80"
      - "443:443"
    networks:
      - caddy
    restart: unless-stopped
    volumes:
      - caddy_data:/data
      - /var/run/docker.sock:/var/run/docker.sock:ro
   
  blogo:
    image: pluja/blogo:latest
    container_name: blogo
    restart: unless-stopped
    networks:
      - caddy
    volumes:
      - ./articles:/app/articles
    environment:
      # CONFIG
      BLOGO_TITLE: Blogo
      BLOGO_DESCRIPTION: A blog built with Blogo!
      BLOGO_KEYWORDS: blog,open source
      BLOGO_URL: REPLACE_WITH_YOUR_DOMAIN
      #BLOGO_ANALYTICS: '<script defer src="https://my.analytics.site/script.js"></script>'
      TIMEZONE: UTC

      # NOSTR CONFIG
      PUBLISH_TO_NOSTR: false
      #NOSTR_NSEC: ""
      #NOSTR_RELAYS: "wss://nostr-pub.wellorder.net,wss://relay.damus.io,wss://relay.nostr.band"

    labels:
      caddy: REPLACE_WITH_YOUR_DOMAIN
      caddy.reverse_proxy: "{{upstreams 3000}}"

networks:
  caddy:
    name: caddy

volumes:
  caddy_data:

Replace REPLACE_WITH_YOUR_DOMAIN with the domain you have configured. This time, do not set the http or https prefix. Example value: blogo.example.com

Step 3: Launch the Services

Ensure that your domain's DNS settings have propagated by checking a site like DNS Checker.

Run the following command to start up your services:

docker compose up -d

Step 4: Access Your Blog

Allow a few minutes for the SSL certificate to be created by Caddy. Then, you can access your Blogo instance at your domain.

You’ve now successfully hosted Blogo on your own domain using Docker and Caddy!