Optical fiber Bragg grating (FBG) displacement sensors play an important role in various areas due to the high sensitivity to displacement. However, it becomes a serious problem of FBG cross-sensitivity of temperature and displacement in applications with FBG displacement sensing. This paper presents a method of temperature insensitive measurement of displacement via using an appropriate layout of the sensor. A displacement sensor is constructed with two FBGs mounted on the opposite surface of a cantilever beam. The wavelengths of the FBGs shift with a horizontal direction displacement acting on the cantilever beam. Displacement measurement can be achieved by demodulating the wavelengths difference of the two FBGs. In this case, the difference of the two FBGs' wavelengths can be taken in order to compensate for the temperature effects. Four cantilever beams with different shapes are designed and the FBG strain distribution is quite different from each other. The deformation and strain distribution of cantilever beams are simulated by using finite element analysis, which is used to optimize the layout of the FBG displacement sensor. Experimental results show that an obvious increase in the sensitivity of this change on the displacement is obtained while temperature dependence greatly reduced. A change in the wavelength can be found with the increase of displacement from 0 to 10mm for a cantilever beam. The physical size of the FBG displacement sensor head can be adjusted to meet the need of different applications, such as structure health monitoring, smart material sensing, aerospace, etc.