DJIBOUTI — The two countries keep dozens of intercontinental nuclear missiles pointed at each other’s cities. Their frigates and fighter jets occasionally face off in the contested waters of the South China Sea.

With no shared border, China and the United States mostly circle each other from afar, relying on satellites and cybersnooping to peek inside the workings of each other’s war machines.

But the two strategic rivals are about to become neighbors in this sun-scorched patch of East African desert. China is constructing its first overseas military base here — just a few miles from Camp Lemonnier, one of the Pentagon’s largest and most important foreign installations.

With increasing tensions over China’s island-building efforts in the South China Sea, American strategists worry that a naval port so close to Camp Lemonnier could provide a front-row seat to the staging ground for American counterterror operations in the Arabian Peninsula and North Africa.