It really depends on what your priorities are. If you want to see the coast, stay in one of the towns there. You can get to them by ferry from either Salerno or Naples. Just pick one and go. Very nice and scenic etc. The downside is they're hellish busy and what limited infrastructure there is can't cope with the amount of visitors. Use the ferry to visit a couple of others, or Capri, and forget about Pompeii etc unless you pay ££££ for a tour company. There are no direct connections to there, or Herculaneum, or Vesuvius. Be aware that pretty much all the beaches are owned by private beach clubs so even if you just want a day at the beach in the town you're staying in, that will also cost you, although there are tiny pockets of very overcrowded public sand.
If you want to see the famous ruins, the volcano, and see some of the coast, your main choice is between Sorrento and Naples. Naples is at one end of a train line with stopping off points for Herculaneum and Pompeii and Vesuvius, Sorrento is at the other. The stops in between are kind of commuter/dormitory places, not too exciting, some quite rough. Both Naples and Sorrento do ferry travel to Amalfi coast towns, and Capri.
Sorrento is right on the edge of the Amalfi coast and slightly closer to the ruins so you'll have shorter trips to each. It also actually "feels" like you're already in the Amalfi area - looks very pretty, etc. This is why it's such a popular place to stay.
Naples - well, Naples is a big multilayered city and can be overwhelming because of the specific way in which it has developed. You can get to all the same places as you can from Sorrento, with slightly longer per day travel times, plus you can go to Ischia and Procida very easily. You also have all the big city attractions, art, culture, museums, architecture etc if that's important to you. In addition you can use it to get to less explored volcanic areas, sunken ruins you can snorkel around, standing ruins, amphitheatres in the wider active caldera.