https://github.com/tailscale/tailscale/tree/main/cmd/nginx-auth is a utility in the tailscale repo allowing users to delegate nginx request authorization to a tailscale daemon running on the same host.