[2D game]What's is the best way to set a background?

I’m developping a 2d side-scoller game, but I’ve some trouble with the background. In the template project the background is a simple sprite located behind the scene, but if i fall of the map (or if my map si too big) it possible go out the background sprite. I’ve try to get a bigger background but the result don’t satisfy me. So I try to attach the background sprite to the camera and finally now i can go anyway without problem, but the immage is static to the character, it means if i walk the background sprite follow me (a horrible effect). I want to create a basic parallax effect, can someone help me?