The same brain regions (insula and anterior cingulate cortex) appear to be engaged whether one is fighting off a bacterial infection or is exposed to stress.
These regions of the brain play a large role in determining how much pain we experience.