Hi,
The pain caused in the lower back can have many causes and is very indicative of the cause of a good physical examination.
According to what you propose to me, I am heading towards a urinary infection or renal lithiasis.
I would recommend that you do a urine test and an abdominopelvic echogram.
It would also be important to know if that pain is accompanied by other symptoms such as fever, nausea, rashes, in addition to a headache you mentioned, and if it is related to postural changes.
Many questions would be more indicative without the need to request laboratory exams. Among the causes of that pain you mention, as I said, there are several:
Urinary infections,
urolithiasis (most likely according to your symptoms). In addition, acute
lumbago due to muscle
contractures,
sciatic nerve irritation, spinal pathologies such as herniated discs, among others, aforementioned
herpes also.
Hope I have answered your query. Let me know if I can assist you further.