I see two potential ways to interpret your question:
1) You could mean a redirect instead of a "rewrite" (a web server term). You want to show the domain, not the IP to the client. That's a redirect.
server {
listen 123.123.123.123:6000;
return 301 https://my.domain.com$request_uri;
}
2) You could mean that traffic from there goes to a specific backend server. Again, I don't think you mean rewriting.
server {
listen 123.123.123.123:6000;
location / {
proxy_pass http://my.domain.com;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
}
}
To be more complete, perhaps you already have content for / and you only want some/path to be served by the other server:
server {
listen 123.123.123.123:6000;
location ~ /some/path {
proxy_pass http://my.domain.com;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
}
location / {
proxy_pass http://123.123.123.123:80;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
}
}
This last one is a common technique to expose multiple micro-service systems as one, thus unifying the domain and simplifying SSL. In my case, I often map anything with _ to my Elasticsearch cluster.