I have my 60's about 8" from the back wall in my living room. I'd rather have them about 14-16" but my kid will crawl back there and shove god knows what into the port If I'm alone I'll pull them out a bit. Then their a little less boomy.
Have my Studio 40's 4 feet from the front wall, and 26" from the side wall. Placement depends on room dimensions, and extensive trial and error as to how they sound in a variety of positions.
Also if you use any room treatments (bass traps and first reflection wall panels) that needs to be factored in when placing speakers.
No hard/fast rules .... just find the spot where the speakers are accurate across the frequency range. And be patient.
My rule of thumb? Stand behind the speakers and put your hand in front of the port. At the point where you no longer feel any air being released from the port at higher than normal volume levels is the minimum distance you can keep the speaker from the wall.
In my experience, that means about 8-12 inches.
Due to my room however, I have them about 30 inches from the wall.
My front ported studios seemed to benefit from being moved an original 12" to 30". From that I'd think the change would be even more evident with rear ported speakers.
Evan's method is the best, this is how I did mine as well. Although I'm only about 8" from the wall I cannot feel the air shooting out and since they are set to small they produce less air then if on large. I have no problems that close to the wall. I have 40's, 2 ports also helps reduce the amount of air each has coming out.