Traditional static pricing strategies are ineffective for cloud providers to maximize their profit since they cannot leverage the supply-and-demand relationship of computing resources hosted in data centers. In this paper, we consider a dynamic server pricing (DSP) problem where the data center operator determines the server price based on the resource demand. In addition, the operator should also take the renewable energy, spot power price, and battery level into account. To solve the DSP problem, we propose a reactive pricing (RP) algorithm which dynamically tunes the server price in response to state change. It is shown through theoretical analysis and real world traces driven simulations that RP achieves a close-to-optimal profit and is robust against exogenous environment variations.