location / { proxy_pass http://***.***.***.***:81; proxy_redirect http://***domain******.ru:8080/ /; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; if ($host != 'www.***domain******.ru' ) { rewrite ^/(.*)$ http://www.***domain******.ru/$1 permanent; } }