Two different things...
But hernias usually require surgery at some point. You can push it back in and use stomach binders and braces to keep it in place. You shouldn't be lifting anything heavy or it'll ter it open more.
Ulcers, avoid spicy foods. Basically eat bland and see if it heals. Various meds help too. Takes an exam or test to see for sure if indeed it's an ulcer.
In both cases see a dr to rule things out.