Hello from JustAnswer.
Aside from ulcers and other acid irritation syndromes, there are a couple of conditions to consider.
A viral infection can cause abdominal pain in any location in the abdomen associated with nausea and vomiting, but it tends to cause symptoms of relatively short duration.
A common cause of upper abdominal pain under the rib that radiates to the back would be from gallbladder disease, and it would be the most common cause of chronic or recurrent symptoms of this nature. The most common cause of gallbladder disease is from gallstones, although a small percentage of cases of gallbladder disease is due to inflammation and infection without gallstones.
It is also possible that there could be an inflammation of the liver, called hepatitis. Hepatitis can be from infection or from inflammation.
The other major consideration would be inflammation of the pancreas, called pancreatitis.
There are several tests that can be done to determine which of these conditions are present, including blood tests and an upper abdominal ultrasound. If the symptoms are less severe and of short duration, it is reasonable to simply give it some time to see if the symptom resolve spontaneously, as would be expected with a viral infection. If the symptoms are more severe, persistent, or recurrent, then it would be appropriate to be seen for an examination and consideration of the above tests.
If I can provide any additional information, please let me know.