How did a play or musical opera get funded and produced in in the 1500's - 1700's

Just curious what the process was to get a play or opera from the manuscript stage to opening night 300-500 years ago. Was it all patron funding, investors, the government… what? Who or what green lighted a production back then?

I can only speak about plays, and only in England, but it would have been a combination of patronage, investment by the actors themselves (they were considered shareholders) and other financial backers, and income from previous productions, with a shift away from the actors and toward outside investors toward the end of the period.

The church did a lot of patronage and it gradually moved to aristocracy then to private people who had money (merchant familes who made good).