server { . . . server_name www.domain1.com; rewrite ^/$ http://www.domain2.com redirect; . . . }