In this paper, the dynamical behavior in a spatially heterogeneous reaction–diffusion SIS epidemic model with general nonlinear incidence and Dirichlet boundary condition is investigated. The well-posedness of solutions, including the global existence, nonnegativity, ultimate boundedness, as well as the existence of compact global attractor, are first established, then the basic reproduction number R0 is calculated by defining the next generation operator. Secondly, the threshold dynamics of the model with respect to R0 are studied. That is, when R0<1 the disease-free steady state is globally asymptotically stable, and when R0>1 the model is uniformly persistent and admits one positive steady state, and under some additional conditions the uniqueness of positive steady state is obtained. Furthermore, some interesting properties of R0 are established, including the calculating formula of R0, the asymptotic profiles of R0 with respect to diffusion rate dI, and the monotonicity of R0 with diffusion rate dI and domain Ω. In addition, the bang–bang-type configuration optimization of R0 also is obtained. This rare result in diffusive equation reveals that we can control disease diffusion at least at one peak. Finally, the numerical examples and simulations are carried out to illustrate the rationality of open problems proposed in this paper, and explore the influence of spatial heterogeneous environment on the disease spread and make a comparison on dynamics between Dirichlet boundary condition and Neumann boundary condition.