We investigate that temperature can be measured by a modified Michelson interferometer, where at least one reflected mirror is replaced by a thermalized sample. Both of two mirrors replaced by the corresponding two thermalized samples can help to approximatively improve the resolution of temperature up to twice than only one mirror replaced by a thermalized sample. For further improving the precision, a nonlinear medium can be employed. The Michelson interferometer is embedded in a gas displaying Kerr nonlinearity. We obtain the analytical equations and numerically calculate the precision with parameters within the reach of current technology, proving that the precision of temperature can be greatly enhanced by using a nonlinear medium. Our results show that one can create an accurate thermometer by measuring the photons in the Michelson interferometer, with no need to directly measure the population of thermalized sample.