Question about startup Directive

I’ve built a docker container that runs both Caddy and a nodejs server. Caddy handles static assets and then hands off other requests to a node server running in the same docker container. My Caddyfile is here:

root /srv/build/

# send other requests to backend
proxy / localhost:81 {
    except /static favicon.ico favicon.png index.html asset-manifest.json

startup node server &

This seems to work fine, but I was wondering why I need the & at the end of my startup directive. It makes sense that I would need it, otherwise the node server runs in the foreground and caddy cannot continue processing. However, when comparing this with abiosoft/caddy:php, php-fpm is started in that container without the trailing &. Is this because php-fpm is not the actual daemon and just starts the process in the background and then exits or something?

Here is a link to the Caddyfile for abiosoft/caddy:php: caddy-docker/Caddyfile at master · abiosoft/caddy-docker · GitHub

and the source:
fastcgi / php
startup php-fpm7
log stdout
errors stdout

I’m not sure, but my guess is that php-fpm goes into the background on its own (@abiosoft would know though)?

Yes. Otherwise & would have been a requirement.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.