
Keep your pecker up
Cheerfulness in Adversity
Used to encourage positivity when someone is facing hard times. 
British Origin
The phrase is primarily understood and used within the UK. 
Informal
It's casual in tone and best used in informal settings or among friends. 