From Lisbon you can catch the train which travels along the coast to Estoril and Cascais, both are pleasant beach resorts. Gibraltar has a few beaches including one at Catalan Bay. You would have to take a taxi, ask the driver for his recommendation. You could take the train from Civitavecchia to Santa Marinella, just a couple of stops along the coast. Livorno does have some beaches, but the one I saw was quite scruffy. Genoa is a major port and the nearest beaches are about 40kms away.
Your best bet here is Villefranche. You will be tendered ashore and there is a good public beach about 10 mins walk over to your right. Gibraltar is a rock, Lisbon a commercial city, Genoa a fascinating city and enormous port. Whilst Livorno and Civitavecchia are essentially commercial ports, setting off places for Florence & Pisa and Rome respectively! If you wanted a beach holiday, you may have been wiser to select another itinerary!
There is a beach really close to the Port in Malaga, you should see it when you arrive. If you want to venture slightly further there is a Train that stops at all the costal resorts along the Costa del Sol as far as Fuengirola they run every 20 mins from the main railway station in Malaga and only costs around 3 euros depending on how far you go.