You asked:

is alofi west of nanjing

Yes. Nan-ching is east of Alofi.
Alofi
Alofi
Alofi

Nan-ching
Nan-ching
Nan-ching