Depends on what you mean by viable target. There was no pure military site, meaning a position with no civilians within the target zone, anywhere in Japan or even in the Mandates. Even Truk, which was a bypassed waste of a base, had significant civilian population, mainly Islanders, but also some Japanese, and a strike on Truk would have had zero impact on Japan.
It is important to keep in mind that the use of the Bomb was meant to do more than just kill people (if that had been the only goal, a straight up fire-bombing attack would have achieved the desired result). The goal was to stun the Japanese government sufficiently that the "peace faction" would be able to gain control of the decision making process and ned the war.
There were other targets within Japan, Nagasaki itself was an alternate target on August 9th (Kokura, the site of a major arsenal, was the primary), but they all were cities (much like any military target in any modern state would have a good sized city nearby) with some military significance. Hiroshima, partly because it had been left unbombed since it was on the Nuclear targeting list, was a significant IJA base, with more than 40,000 troops billeted there, along with the HQ of the 2nd General Army (which was the command responsible for defending Kyushu, the site of the first planned Allied landings in the Home Islands). Nagasaki included the shore facilities for Sasebo Naval Base, where the Naval C&C for Kyushu was located as well as several significant manufacturing facilities, including a major Mitsubishi plant.
Both cities were, under any definition, legitimate military targets under the laws of war in 1945 and would be legitimate targets even under the much more restrictive definitions found in the current Geneva Conventions. Whether the mass bombing of civilians was EVER a good moral decision is a more difficult question to answer, but the cities were both legal targets.