Geez, what's with all the Debbie Downers here?
Let me clarify some misconceptions ITT:
#"Android is not designed for this":
Whilst this is technically true, Android is still ultimately Linux at heart, which still allows you to do a lot of cool things - yes, that includes running servers. You could install Termux and run headless versions of pretty much every kind of server, or even run a full-blown Linux distro in proot mode if you need more flexibility. And if you've got a recent-ish Pixel, you could even use pKVM to run a distro at near baremetal speeds and greater flexibility compared to proot. But even without a Linux distro, you can just run a plain old server app and beat Android's OOM killer by using Tasker (or similar) as a watchdog/keepalive service. You can even simulate input using Tasker, which will prevent the phone from going into an idle state and killing your app.
However, the best option would be rooting your device - once rooted, you can directly tweak the kernel's OOM parameters to prevent your app from being killed, as well as change your CPU governor to "performance", plus enable/increase your zram swap and stuff - all of which allow you to reliably run a server with good performance, and little risk of being killed off.
There's a reason why there are already servers apps on the Play Store (which can make optional use of root access), because Android is more than capable of running servers - and there's no need for Termux/Tasker and all that fancy Linux stuff - but you can go down that rabbit hole if you wanted to.
#"Proxmox on an old x86 box is better":
Sure, but it's also completely overkill if all you want is say an FTP/NextCloud server or something. NextCloud has a minimum requirement of only 128MB RAM per process, and an overall recommend of 2GB + 2 CPU cores. Now compare this with my 5-year old OnePlus 6 with 8GB RAM and 8 CPU cores - this is more than enough to run NextCloud, with an external HDD/SSD attached via a USB-C dock. This setup will use far, far less power compared to a full-fledged PC, not to mention, make zero noise, and use a fraction of the space. I mean, if you've got a spare old PC lying around and you don't care about power consumption, then go right ahead, but for people who do care, using an old Android phone can certainly be a viable option.
#"Security nightmare":
True, but that's assuming you're using the stock OS. Use a trusted and up-to-date custom ROM like LineageOS or GrapheneOS and you'll be fine.
#"Unlockable bootloaders":
So don't buy/use a phone with a locked bootloader then? In all my history of Android phones dating back to 2009, I've never owned a phone with a bootloader which wasn't unlockable (whether officially or not), and this was a conscious buying decision on my part. Don't like locked bootloaders, then don't buy one, as simple as that! But even if you haven't had the same foresight as me, it's not really a big problem is it? Just sell your old locked device and buy an unlockable one from eBay or Swappa, they're pretty cheap too, so there's really no excuse here.
#"Zero repairability":
Untrue, assuming you're using an (ex) mainstream device, plenty of spares can be found on sites like iFixit and eBay for even very old phones. Heck, you could even buy an entire used/cosmetic fault phone on eBay and just swap out the parts you need. The main roadblock with repairing phones is usually the display, but if your phone is just going to be plugged in and sitting around, then that's not really a concern is it? Besides that, swapping out the mobo isn't an impossible task if you know how to follow instructions on iFixit.
#"Zero upgradability/storage runs short":
As mentioned earlier, just use an external HDD and you're all good to go. Why would you even consider using the onboard phone storage?! As for upgrading the rest of the system, well just swap out your old phone with your current one when you're gonna upgrade, problem solved!
Now come, fight me, naysayers! (ง •̀_•́)ง