Nginx rewrite rule question – Stack Exchange of Webmasters

I have a server with several domains on it.

One of these domains that I have to redirect to another domain, which is on a different server, but I want to let the request to / wp-admin / on this area.

For example, suppose the domain is

I want all the requests to to be accepted and processed by the nginx server in question. Also, ... must be accepted. All that is required for or should be redirected to

For example, and and (www) / something else (except / wp-admin / and wp-login.php ...) should be redirected. Where the demand is redirected, it is not necessary to include in the rewrite anything that could have been placed after the domain name. So in the case of the / folder1 / part can be completely ignored.

Currently I have server_name and to be listened to, and then I have:

if ($ host = {
rewrite ^ / $ permanent;

But obviously that does not allow pass through.

In addition, requests for ... will need to pass too.

What is the best way to achieve this?