There are a lot of "campers" around San Francisco. The all avoid parking in front of any private residence unless they can claim (and be backed up) by the resident himself. The "rule" seems to be that space in front of or too near private residential property is off limits.
Curbs along city parks are fine; industrial areas are not so good mostly because at night there is _nobody_ around except people you don't want to meet and they might be looking to meet you. People do use the industrial areas but they tend to "raft up" in small groups of say 3 to 5 vehicles spaced over a block or two.
Pay attention to the cops or at least understand that they are paying attention to you. Even though most large city police usually have enough "real" work to keep them busy, even the dumb ones tend to know their area pretty well - IOW except in large 24 hour parking lots they _will_ notice you and sometimes even in the large lots. The idea is to be neat, clean and low impact and absolutely innocuous so they'll let it slide cuz they have more important stuff to do. When (not if) you talk to them try to maintain an absolutely even keel, low key agreeable manner w/out giving away anything you don't have to; when possible dress like a well heeled snow bird or the niece thereof. There was a DVD made a few years ago about how to maintain you rights with the law and avoid getting into more trouble. I'll see if I can find a link somewhere.
Most cities I've checked have laws against sleeping in a vehicle on the street. That means it's totally a matter of the individuals on the job at the time and how they run their turf. Sometimes the legal code references private property - that's one reason the San Francisco campers never park in front of residences.
Small towns are more varied and problematic because the locals usually have more time and interest to check out anything new and different - like you. Also, the whole show is run by one or two people so they have a LOT of authority and can basically do what they feel like - which can be both good and bad. The local kids (18-30 years) also have less to do and are more likely looking for diversion. When I traveled in my van in small towns I tried to park near residential areas where any big ruckus (like my car alarm) would have a chance to bring out the neighbors and the law. I'd stop near a park with homes across the street or, if necessary, I'd park on a residential street more or less _between_ two properties so I was maybe in no-mans land. I was traveling in a full size window van at the time.
People have mentioned a dog. Unless you're deathly allergic, it'd be a real good idea to fall in love with a large dog who clearly feels it needs to protect you and will say so. Animals are a lot of work (if you do it right) but a good dog is worth more than any other single bit of security available. They also (if you arrange good ventilation so they don't bake) make the best burglar deterrent while you're out on business.
I don't think carrying a gun is smart unless you're well and currently trained and have some police experience. For the rest of us our society has made the gun a symbol and fetish, a hot button that does nothing but distract us and give us delusions - which can get us hurt.
You can do this and it can be GREAT out there. But don't go thinking it'll be like a vacation cruise ship - unless you're only going to play around for a few weeks. Being self reliant takes work and _applied_ common sense. You gotta look sharp and pay attention and keep your body and attitude and home and relationships all clean, oiled and humming w/out the usual buffer between you and the bottom line. The bottom line is real close on the road. But that makes it all the more real and you can come out of it way richer in many ways.
Here's a link to a guy who's been living small for a while and is really into it. Also check out the links on his page to find some others similarly inclined.
http://urbanvandweller.blogspot.com/200 ... d-for.html
Best luck.
Rufus