The outbreak of COVID-19 has disrupted our regular life. Many state and local authorities have enforced a cordon sanitaire for the protection of sensitive areas. Travelers can only travel across the cordon after being qualified. This paper aims to propose a method to determine the optimal deployment of cordon sanitaire in terms of the number of parallel checkpoints at each entry link for regular epidemic control. A bilevel programming model is formulated where the lower-level is the transport system equilibrium with queueing to predict traffic inflow, and the upper-level is queueing network optimization, which is an integer nonlinear programming. The objective of this optimization is to minimize the total operation cost of checkpoints with a predetermined maximum waiting time. Note that stochastic queueing theory is used to represent the waiting phenomenon at each entry link. A heuristic algorithm is designed to solve the proposed bilevel model where the method of successive averages (MSA) is adopted for the lower-level model, and the genetic algorithm (GA) is adopted for the upper-level model. An experimental study is conducted to demonstrate the effectiveness of the proposed method and algorithm. The results show that the methods can find a good heuristic optimal solution. These methods are useful for policymakers to determine the optimal deployment of cordon sanitaire for hazard prevention and control.