For nibbling, pinching the upper lip works quite well, especially with foals. It should be perceived as a direct result of lips/teeth contact with skin, so it is best to do it instantly, silently and without fuss. Maintaining the pinch for a second or two while the foal recoils seems to work better than letting go straight away.
However, the technique I have found most effective, especially with older horses, is to offer a hand to nibble on, let him start to take my hand into his mouth, then promptly stick a knuckle or (with palm turned upward) a fingertip firmly into his soft palate causing him to try and spit my hand out. (I say "him" because this behaviour is more common in males, but you could apply this equally well to a filly.) One has to be prepared for the few horses that raise their heads up beyond arm's reach. It always helps to keep everything calm and matter-of-fact, to avoid startling the horse.
Obviously you should always have a quick escape route for your fingers - usually the gap behind the incisors. You need to be more cautious with very small pony mouths or horses with tushes. I try to keep the finger contact going for a couple of seconds while he tries to spit it out/get rid of it with his tongue. You don't want to hurt or injure; you just want to create a uncomfortable sensation - something the horse dislikes.
With a little deftness you can intercept nibbles and attempted nips elsewhere (e.g. on your clothing) in such a way that the horse comes to realize that it is unpleasant and not worth nibbling anywhere on your person.
I do think it helps if your response to nibbling is perceived as a consequence of the horse's own action and not as a reprimand. At least, that way you avoid it being seen as an act of aggression which might then escalate to power/dominance "games". I really try to avoid those. I also don't like hitting the horse on the nose. It may seem a justified response to what is undoubtedly an annoying and potentially dangerous behaviour, but it can have unwanted consequences - it can make some horses headshy, and with others (colts especially) it can turn it into an escalating battle of wits. Many times I've seen both of those happen.
Two or three repeats of "finger in palate" over a couple of sessions is usually all it takes to stop the behaviour completely. That's right - you may only need to do it six times in total. After that, if you offer your hand up to her mouth, you will see her thinking about taking it, as she might have done before, and then deciding to keep her mouth firmly shut!
With this method I have taught many foals and young colts not to nip. I've also used it successfully with a few problem stallions who had their mouthiness turned into more serious nipping by badly administered punishment (which turned it into a pernicious "game"). I haven't yet come across a horse for whom this hasn't worked. The important thing is to stop the nipping while it is still "good natured" and before it becomes aggressive and nasty.
If you are thinking this is not a safe technique to do yourself, that's fair enough. I am very safety conscious and I have never been even slightly hurt doing it. Actually, going into a horse's mouth isn't such a big deal - you may do it from time to time already, when you give wormer. And it's not like you have to do this very often - maybe half a dozen times in total, as I said - most horses learn this lesson very qucikly! However, if you are at all worried about doing it (maybe your horse isn't just nibbling but snapping aggressively) then DON'T DO IT! All I will say is it works extremely well for me.