我想将我的端口号添加到我的弹性IP中以集成到我的域中。但是它不允许添加端口。 它只允许我添加我的弹性IP。如何将我的端口添加到我的弹性IP? 比如,我的域名是www.xxyyzz.com ,我想将我的弹性IP xx.xx.xx.xx和我的端口:8888添加到该域名。 如果我运行www.xxyyzz.com,它将指向xx.xx.xx.xx:8888 。 我怎样才能做到这一点? 或者还有其他方法可以实现吗?
I want to add my port number to my Elastic IP to integrating into my domain.But it won't allow adding a port. It only allows me to add my Elastic IP.How can I add my port to my elastic IP? Like, my domain is www.xxyyzz.com and I want to add my Elastic IP xx.xx.xx.xx and my port:8888 to that domain name. If i run www.xxyyzz.com it will point xx.xx.xx.xx:8888. How can I achieve this? Or is there any other way to achieve it?
最满意答案
您应该使用反向代理作为nginx来执行此操作。 这不是DNS规则。
server { listen 80; server_name your-domain-name.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://X.X.X.X:8888; } }Finally ,I solved the problem using iptables to redirect any request to my own port 8888. I used below command to redirect all the request fro 80 to 8888. Now it works fine.
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8888
更多推荐
发布评论