First you need to settle the copyright issue. Who holds it and if it isn't you then what license do you hold from the copyright owner? I doubt that even if a university holds the copyright that they would prevent you publishing your own work. It is more complicated, however, if the work can't be considered a "sole" work due to having been done in a research lab. But settle that first. Part of that is any issues of confidentiality that might arise.
In particular, I would consider a university explicitly monetizing the "sole works" of its students to be very wrong.
Assuming that you have the rights to do it you still have some issues. Publishing "online" is unlikely to result in any monetary payback unless you find a way to put it behind a paywall which has upfront as well as continuing costs. Publishing on arXiv, for example, doesn't pay you anything other than possible "reputation points".
You can, with the appropriate rights, turn it into a book. Some publishers might be interested and would pay royalties, but you will find, almost always, that those disappear within a couple of years.
You can also self-publish a book, perhaps through Amazon.com who provide support for such things. The upfront cost to authors is zero, but it is difficult for potential readers to find such things so the payment you get from the effort will likely be small unless most of the potential readers already know how to find it (and you). If you have an extensive online presence or otherwise high visibility in your field then it might be possible. I've self published textbooks successfully, but literally everyone interested already knew me and how to find my university website. But even that ends after a few years as the needs of the curriculum change.
Note that while a work might be important in a scientific field, the actual audience for it might still be small. The hugely profitable books are more likely to be popularizations of academic work such as those by Carl Sagan, who did real science, but was widely known for his more general explanations which were accessible to non-experts.
To sum it up. It is probably more effort than it is (monetarily) worth. There may be other "paybacks", but in visibility and reputation.