Over the decades I’ve been a big fan of MAMP for macOS as Greg mentioned, as well as XAMP for Windows as J. mentioned.
Another alternative would to simply spin up a VM and host your tests in there. The huge benefit is that you can use the same/similar distro that you might use if ever go production plus with most modern day VM software, you can create snapshots so that you can run experiments and then quickly and easily roll back to a prior state.
I was just about to post this for you…
VMware Fusion and Workstation are Now Free for All Users
…but noticed that right above you mentioned you’re a UTM user. Linux works awesome over there, but I don’t think UTM has any kind of snapshot technology other than simply cloning a VM.