Generally speaking, you have three options:
- work for a large-city-based firm, but work remotely some or all of the time, allowing you to live an hour or two away in a small city or even the remote countryside. This will require you to be very good at your job, and to have been with the company long enough for them to trust you. Another approach is to be so spectacular at your job that a new firm will take you on even if that means you must work remotely.
- find a firm that is based in a small town you would be willing to live in, and get hired there, knowing that you will have few options to change jobs if you don't like it. This requires a great deal of research to find such firms (but they do exist) and establish if you would like the job or not before making the commitment. Some people do a "reverse commute" where they live in the big city for a while and drive out to the country until they are sure they like the job and they have found their dream house
- don't try to support yourself with one job, but instead have a mix of clients. Provide your services to them remotely. This requires you to be somewhere between good and spectacular at your job, plus have some selling ability and a lot of managing ability. It can be both the riskiest and the most rewarding approach.
Everyone I know who lives in Hawaii has taken option 1 and works for a company based outside of Hawaii. I have had clients in small towns throughout North America whose staff were all doing option 2. All those clients had trouble attracting and keeping staff, btw. You and I may want to live in the small town but most people don't, and that's primarily why the firms are not there. I personally took option 3 twenty five years ago when I moved my small consulting firm to the countryside. I have had a great career and life here but I won't deny there were times that were very hard, when living in the city would have made things much easier.
You need to take a long term view and make a long term plan. Average, ordinary, forgettable folks tend not to have these options. Whether it's blogging, public speaking, open source, or something similar, you need people to remember you and to notice you are good. You need to be good too, which probably means learning and practicing on your own time, not just at work. You need to be able to tell people you're good, and to know precisely what you're good at. This all takes time. Now is a good time to start.