Faraday rotation spectroscopy (FRS) is generally used to detect the concentrations of various paramagnetic trace gases because of its high detection sensitivity, zero background noise and the ability to get rid of the interference of diamagnetic materials effectively. In most of FRS technologies, the used electromagnetic fields are produced by coils, thereby triggering off some problems such as high energy consumption and excessive heat generation. Thus the modeling and the simulation study of spatial magnetic field distribution based on the combined ring permanent magnets are carried out to establish an axially distributed homogeneous magnetic field and provide a permanent magnet-based homogeneous magnetic field along the optical axis for FRS measurement. In this simulation, the method of finite element mesh division is adopted based on basic electromagnetic relationship in Maxwell equations. By the simulation study of the magnetic field distribution of the actual Nd-Fe-B permanent magnet magnetic ring array, the physical model proves to be reliable. Basically, three methods of optimizing the permanent magnetic ring arrays. i.e. single ideal value optimization method, the multi-part single objective optimization method, and the gradient optimization method, are proposed. The single ideal value optimization method and the multiple ideal value optimization method are used to realize the optimization of magnets. However, by analyzing the two methods, it is clear that compared with the single ideal value optimization method, the multiple ideal value optimization method in which the whole region is divided into several small parts can achieve good uniformity of permanent magnet array. In this way, the third method, i.e. the gradient optimization method is used to realize the construction of a homogeneous magnetic field with a uniform central axis magnetic flux density distribution used for FRS. Finally, the standard magnetic field uniformity for measuring the quality of magnet field is suggested, and through the calculation and evaluation of the magnetic field uniformity, the optimization effects of different optimization methods are analyzed and compared with each other. And the final results about realizing a homogeneous magnetic field provide a reference for developing the FRS equipment based on permanent magnets.