Viruses have two modes spread in a host body, one is to release infectious particles from infected cells (global infection) and the other is to infect directly from an infected cell to an adjacent cell (local infection). Since the mode of spread affects the evolution of life history traits, such as virulence, it is important to reveal what level of global and local infection is selected. Previous studies of the evolution of global and local infection have paid little attention to its dependency on the measures of spatial configuration. Here we show the evolutionarily stable proportion of global and local infection, and how it depends on the distribution of target cells. Using an epidemic model on a regular lattice, we consider the infection dynamics by pair approximation and check the evolutionarily stable strategy. We also conduct the Monte-Carlo simulation to observe evolutionary dynamics. We show that a higher local infection is selected as target cells become clustered. Surprisingly, the selected strategy depends not only on the degree of clustering but also the abundance of target cells per se.