Lack of access to reliable energy is a major concern for countries in sub-Saharan Africa. The national grids are unable to consistently satisfy demand. Therefore, users turn to distributed generation systems in the form of back-up generators. However, such systems are usually designed based on a rule of thumb. We employ a mixed-integer linear programming model that considers several options such as renewable energy, combined heat and power, and storage technologies, in addition to those on-site, to provide optimal design and dispatch decisions that minimize total cost. We apply this model to a case study for a hospital in South Africa, considering its need for reliable electricity in light of multiple outages that might occur over the course of a year, as well as its high heating and cooling loads. Our results show that optimal design and dispatch decisions for the distributed generation system address reliability challenges, regardless of the time at which they occur. And, these solutions yield millions of dollars in savings, suggesting that technologies such as the absorption chiller may be overlooked in typical designs; its integration can reduce demand charges even in the absence of combined heat and power. We show that total cost is most sensitive to changes in site electrical demand, followed by capital cost, fuel cost, photovoltaic production, and monthly demand charges; changes in fuel cost primarily affect system sizes of combined heat and power and the absorption chiller, while photovoltaic system size is more sensitive to the changes in capital and fuel costs, photovoltaic resource availability, and hourly electrical demand. Finally, an outage simulator demonstrates the ability of our optimized system to sustain with no interruptions in power five-hour outages with probability 1.0 and ten-hour outages with probability 0.65, significant improvements over 0.5 and 0.0, respectively, under a business-as-usual case.