Numerous studies across a wide range of taxa have demonstrated that immune genes are routinely among the most rapidly evolving genes in the genome. This observation, however, does not address what proportion of immune genes undergo strong selection during adaptation to novel environments. Here, we determine the extent of very recent divergence in genes with immune function across five populations of Drosophila melanogaster and find that immune genes do not show an overall trend of recent rapid adaptation. Our population-based approach uses a set of carefully matched control genes to account for the effects of demography and local recombination rate, allowing us to identify whether specific immune functions are putative targets of strong selection. We find evidence that viral-defense genes are rapidly evolving in Drosophila at multiple timescales. Local adaptation to bacteria and fungi is less extreme and primarily occurs through changes in recognition and effector genes rather than large-scale changes to the regulation of the immune response. Surprisingly, genes in the Toll pathway, which show a high rate of adaptive substitution between the D. melanogaster and D. simulans lineages, show little population differentiation. Quantifying the flies for resistance to a generalist Gram-positive bacterial pathogen, we found that this genetic pattern of low population differentiation was recapitulated at the phenotypic level. In sum, our results highlight the complexity of immune evolution and suggest that Drosophila immune genes do not follow a uniform trajectory of strong directional selection as flies encounter new environments.