Since you're talking about nginx you're talking about TCP-based protocols. There is no practical way to "change the ip address" and have two-way communication, which is necessary for TCP-based protocols to work.
Something like TOR routes traffic through a network of machines to disguise the original source IP address of the traffic. Your server would see the source IP address as being the last node in the TOR network (called the "exit node") that the traffic was routed through. There's no practical way for your nginx server to keep track of all the possible TOR exit nodes for blocking traffic from those nodes (that list changes every day) and no practical way to recover the original source IP address.