Welcome to the Android Enthusiasts, Majk! We support end-users with Android-specific issues, but cannot help you setting up a Linux server on a device, though it was running Android before. Still, some helpful hints:
- There are means to control your device even with a broken screen. We've got several issues reported where people wanted to do exactly that. Please check e.g.:
- There are several web server apps available for Android as well. Even some supporting/including things like PHP and MySQL. Some examples:
I guess that should get you started if you want to solve your issue using Android. And as I initially wrote: Doing that with any other OS, even on an "Android device", is beyond the scope of this site. But I would wonder if you will really need that, after these details – right? :)