Every time I've tried to use a pi as a long-lived server, the SD card ends up getting corrupted. Switched to a chromebox running kodi for my media server, running 24/7, five or six years ago and haven't had a single problem with it.

In addition to the other helpful suggestions you’ve received, look into using Log2Ram. It does what it sounds like, puts log writes in ram and then writes them to disk on a slower cadence that doesn’t work your SD card that much.

https://github.com/azlux/log2ram