We study the problem of finding the profit-maximizing mechanism for a monopolistic provider of a single, non-excludable public good. Our model covers the most general setting, namely, we allow for correlation in the signal distribution as well as for informational externalities in the valuations. We show that the optimal deterministic, ex-post incentive compatible, ex-post individual rational mechanism can be computed in polynomial time by reducing the problem to finding a maximal weight closure in a directed graph. Node weights in the graph correspond to conditional virtual values, while the network structure is arising from the monotonicity constraints. We discuss what can be achieved if we relax our core assumptions one by one, i.e., if we go for randomized, interim individual rational or Bayes Nash implementable mechanisms. Finally, we demonstrate that our techniques can be adapted for the excludable public good problem as well.