itsdmd

Personal blog

Self-host WordPress with Cloudflare Tunnel

After using Portainer to set up my self-host instance of WordPress (which is used for hosting this blog site!), I wasn’t able to access it via my Cloudflare Tunnel service although all configurations are correct.

This problem seems to not be mine specifically, since some people had encountered it in the past when I was looking up about this problem. anthony27 suggested that this is due to the way WordPress handles SSL certification.

Source

However, in my case, the page kept loading without any response until it reached timeout error. That’s why I believed that it was not directly related to service or certification denial, but due to request redirection making it unable to find its target. After a bit of digging, I found another post that have a high potential of solving my problem.

Source

zarkoff95 suggested that it might be the problem caused by mismatching the host address of CF Tunnel and WordPress during the set up process. I tried this solution out by first removing the WordPress stack and its volumes, then run docker compose again. However, this time, I changed the host address to access WordPress set up page to match with my CF Tunnel.

After successfully setting up WordPress, I went to Settings > General, and change the “Site Address (URL)” to my CF Tunnel domain (https://blog.itsdmd.com). After being able to view the site with that domain, I proceeded to change “WordPress Address (URL)” to the same domain and access my admin console from remote address.

The reason that I had to change both of them is that if the two URLs are different from each other, I cannot publish or update posts and pages.

Everything seems to be working fine after the configuration. WordPress’ Site Health tool didn’t report any connection problems, and I am able to install plugins from the store.

Jetpack plugin was installed via built-in store
Site Health didn’t report any problems