server {
    listen              80;
    server_name         www.xxx.com xxx.com;
    return 301 http://42.192.10.10; 
}

实例

 {
        listen 80;
        server_name oe.xxxx.com;
        return 301 https://$http_host$request_uri;
}

upstream跳转

conf.d/vhosts.conf

upstream s8504{
    #ip_hash;
    #server 172.17.214.104:8501 weight=1;
    server 172.17.214.108:8504;
}

server {
    listen              80;
    server_name         sx.xxxx.com;
    charset  utf-8;

    location / {  
        proxy_pass  http://s8504;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
    }
}