We study how a strong gravity affects the equation of state of matters. For this purpose, we employ a canonical ensemble of classical monoatomic ideal gas inside a box in a Rindler spacetime. The total energy decreases monotonically with the increase of the external gravity representing its attractiveness. It is however bounded below, which is different from that of the Newtonian gravity case. As for the entropy, it decreases with the external gravity in the Newtonian regime. However, in the presence of strong gravity or ultra-relativistic high temperature, the entropy increases with the gravity. This result can be a resolution of the negative entropy problem of the ideal gas in the Newtonian gravity. In the presence of strong gravity, the bottom of the box is very close to the event horizon of the Rindler spacetime mimicking a blackhole and the gas behaves as if it is on an effective two dimensional surface located at the bottom of the box. Investigating the equation of state in the strong gravity regime, the temperature of the system is found to be not a free parameter but to approach a fixed value proportional to the external gravity, which is reminiscent of the Unruh temperature.