Spatial abiotic heterogeneity can result in divergent selection, hence might increase the magnitude of host–parasite local adaptation (the mean difference in fitness of sympatric vs. allopatric host–parasite combinations). We explicitly tested this hypothesis by measuring local adaptation in experimentally coevolved populations of bacteria and viruses evolved in the same or different nutrient media. Consistent with previous work, we found that mean levels of evolved phage infectivity and bacteria resistance varied with nutrient concentration, with maximal levels at nutrient concentrations that supported the greatest densities of bacteria. Despite this variation in evolved mean infectivity and resistance between treatments, we found that parasite local adaptation was greatly increased when measured between populations evolved in different, compared with the same, media. This pattern is likely to have resulted from different media imposing divergent selection on bacterial hosts, and phages in turn adapting to their local hosts. These results demonstrate that the abiotic environment can play a strong and predictable role in driving patterns of local adaptation.