Immune defenses are triggered by microbe-associated molecular patterns or as a result of damage to host cells. The elicitors of immune responses in the nematode Caenorhabditis elegans are unclear. Using a genome-wide RNA-mediated interference (RNAi) screen, we identified the G protein-coupled receptor (GPCR) DCAR-1 as being required for the response to fungal infection and wounding. DCAR-1 acted in the epidermis to regulate the expression of antimicrobial peptides via a conserved p38 mitogen-activated protein kinase pathway. Through targeted metabolomics analysis we identified the tyrosine derivative 4-hydroxyphenyllactic acid (HPLA) as an endogenous ligand. Our findings reveal DCAR-1 and its cognate ligand HPLA to be triggers of the epidermal innate immune response in C. elegans and highlight the ancient role of GPCRs in host defense.