Termux has nginx, postgres, python and plenty of stuff compiled to ARM so I bet you can. You would have to be wary of non standard ports unless you have root access and make sure android does not kill or puts to sleep termux by adding exceptions to the app.
I remember running a few low traffic Mastodon bots in a S3 Mini years ago and it was decent.
Thanks to your comment I gave termux another try and finally figured out what I was doing wrong (pgk updates never working). DO NOT install termux from the Play Store, use FDROID. If you use the play store version you have an old and outdated version with old and broken package repos.
Until one week ago I was using an old Samsung A20 with good results. I moved to a mini PC as I wanted to host Immich server and I felt it was too much for the phone (it might not be the case though...)
Software:
Termux (android app)
SSH (OpenSSH in Termux)
Rclone (in Termux)
Sonarr, Radarr, Lidarr, Prowlarr (in proot-distro)
Transmission (in proot-distro)
Kavitha (in proot-distro)
Podgrab (in proot-distro)
Ombi (in proot-distro)
ntfy (in proot-distro)
Filebrowser (in proot-distro)
Vaultwarden (in proot-distro)
Homer with lighttpd (in proot-distro)
TLDR: Go for it! Use Termux with proot-distro to avoid headaches
Until one week ago I was using an old Samsung S20 with good results. I moved to a mini PC as I wanted to host Immich server and I felt it was too much for the phone (it might not be the case though...)
If postmarket os works on that device maybe you can go full Linux (alpine), there will be no systemd which might be a problem and I am not even sure about docker compatibility. You can look it up though.
Tried to host a pihole with distrobix some time ago, eventually it just stopped responding sadly. I want a debian server that I can ssh into, it's the bare minimum to host stuff IMO. Tmux is great, but I use it as a client, not a server.
Best case would be to trash the whole android os and somehow get a real Linux distro running headless (I know android is technically Linux, but it does not count)
Can anyone chime in about the safety of this from a battery standpoint? If it's going to function that way it'll probably have to be plugged in all the time, and that device's battery is not removable.