Answer the question
In order to leave comments, you need to log in
Forwarding from Domain to IP:port. How can I do that?
There is:
A server with a program that sits on a specific port (Let's say ip - 1.1.1.1, port - 10) (There is no access to it, no, in general, even iptables can not be changed)
Domain (Let's say example.com)
What you need: so that when when going to example.com, the user was redirected to 1.1.1.1:10, all options are considered, even the most crutch, inconvenient, etc.
If possible, explain in simple terms, because I am not strong in system administration.
Answer the question
In order to leave comments, you need to log in
Raise nginx, set up a virtual host in proxy mode, something like this:
server {
listen 80;
server_name example.com;
access_log /var/log/nginx/example.com-access.log;
error_log /var/log/nginx/example.com-error.log;
location / {
proxy_pass http://1.1.1.1:10;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
Establish a web server on port 80, and then transfer everyone to the HTTP Location header http://1.1.1.1:10/
. Or use the web server as a reverse proxy, proxy it to the samehttp://1.1.1.1:10/
It is impossible in principle. There are no alternatives and there cannot be.
Network resources are accessed by IP address.
A domain is simply a name associated with an IP address.
You make a DNS query for a domain name, it returns you an IP address.
The domain name has nothing to do with the port.
When going to example.com, the user will be redirected to 1.1.1.1
And when going to example.com:10, the user will always be redirected to 1.1.1.1:10
Describe the task in more detail - what exactly do you want to do. Most likely you need a reverse proxy. For example Nginx.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question