Caddy - Subdirectory Blog Hosting

Learn how to set up a blog using Hyvor Blogs on a subdirectory with Caddy Web Server.

This is a short guide on how to set up a blog on a subdirectory of your website using Caddy reverse proxy and Hyvor Blogs.

Set up your blog

First, head over to the Hyvor Blogs Console and create a new blog.

Then, set the following settings in Settings -> Hosting.

  • Set Hosted At to Self-Hosting

  • Set Self-hosting URL to the full URL of your blog. You can use localhost if needed. Some examples are:

    • http://localhost:9991/blog

    • https://example.com/blog

  • Turn off Redirect Subdomain (important)

Hosting URL

Update your Caddyfile

The basic rules for setting up Caddy is as follows:

1example.com {
2 handle_path /blog* {
3 reverse_proxy https://yoursubdomain.hyvorblogs.io {
4 header_up Host {upstream_hostport}
5 }
6 }
7}

Make the following changes:

  • Replace yoursubdomain with the subdomain of your blog. You can find it in Settings -> Hosting.

  • Replace example.com with your domain (this may be different based on your Caddyfile)

  • If you are hosting your blog somewhere else than /blog, change the /blog* rule.

References

Comments

Published with Hyvor Blogs