On some occasions one of the records in a service file will name the soldier's home town or county.
These are (but are not limited to) the following --
1) Muster rolls
2) Furloughs
3) Prisoner-of-war records, including paroles.
Normally I rely on the 1860 census schedules for the kind of information you mentioned.