As Actinobacillus pleuropneumonniae (APP) infection causes considerable losses in the pig industry, there is a growing need to develop effective therapeutic interventions that leverage host immune defense mechanisms to combat these pathogens. To demonstrate the role of microRNA (miR)-127 in controlling bacterial infection against APP. Moreover, to investigate a signaling pathway in macrophages that controls the production of anti-microbial peptides. Firstly, we evaluated the effect of miR-127 on APP-infected pigs by cell count/enzyme-linked immunosorbent assay (ELISA). Then the impact of miR-127 on immune cells was detected. The cytokines tumor necrosis factor (TNF)-α and interleukin (IL)-6 were evaluated by ELISA. The expression of cytokines (anti-microbial peptides [AMPs]) was assessed using quantitative polymerase chain reaction. The expression level of IL-6, TNF-α and p-P65 were analyzed by western blot. The expression of p65 in the immune cells was investigated by immunofluorescence. miR-127 showed a protective effect on APP-infected macrophage. Moreover, the protective effect might depend on its regulation of macrophage bactericidal activity and the generation of IL-22, IL-17 and AMPs by targeting sphingosine-1-phosphate receptor3 (SIPR3), the element involved in the Toll-like receptor (TLR) cascades. Together, we identify that miR-127 is a regulator of S1PR3 and then regulates TLR/nuclear factor-κB signaling in macrophages with anti-bacterial acticity, and it might be a potential target for treating inflammatory diseases caused by APP.