In a long mountain tunnel, the method of segmented longitudinal ventilation by shafts is more often used, which is concerned with many aspects, such as tunnel features, traffic condition, weather characteristic and environment request, but there is no conclusion for the relation position of the shaft and tunnel in the academia. Based on the discrimination standards of pollutant volume fraction and the computational fluid dynamics method, the optimization method of shaft location was studied by FLOW-3D as the analysis tool and referring the prediction data of prospect traffic from the tunnel feasibility report, which could consider the traffic pollution and environment in the tunnel and influencing factors out the shaft. First, under the related assumption of computational fluid dynamics, the dynamic analysis of air transferred in the tunnel and shaft was given. Then the shaft location optimization was obtained by the data fitting method and the high order polynomial. The optimization method was used to study an exact tunnel, in which the suitable distance was 1km for the shaft. The conclusion showed that the best location of the shaft was 519 m from the air inlet and the distance between the inlet and outlet was 1.079. Finally the rationality and reliability of this optimization method was verified by an example for studying the segmented longitudinal ventilation by shafts in other research.