Caddy is great, but server setup is painful.
So, let’s use Google Cloud Run. You can use Caddy in minutes.
With Always Free, you can try it with little concern for billing.
Contracted Google Cloud Platform and completed Google Cloud Run official documentation “Quickstart: Build and Deploy”:
Caddy + PHP
This replaces php:apache.
Put the files to be installed in root together with Dockerfile.
Build: (or docker)
gcloud builds submit --tag gcr.io/PROJECT-ID/caddy
Deploy: (or GCP console)
gcloud run deploy --image gcr.io/PROJECT-ID/caddy --platform managed
502 Bad Gateway immediately after deployment. At that time php-fpm is still booting.
Freely editable Caddyfile
Display today’s date using a template.
gcloud builds submit --tag gcr.io/PROJECT-ID/caddy gcloud run deploy --image gcr.io/PROJECT-ID/caddy --platform managed
- This Caddy is v1. v1 and v2 have a difference in the syntax of Caddyfile.
- Do not change after Caddyfile:
This (IP address:port and custom domain) is realized on Cloud Run side.