简体   繁体   中英

DNS record with different ports

I have a very cheap VPS with the IP 123.123.123.123 which listens on these ports: 7000, 7001, ... 7020. Apache listens on port 7010. Then I can access my website with http://123.123.123.123:7010 .
As this is a shared IP, I cannot listen on port 80 myself with my VPS: I only have access to 7000 ... 7020.

I have registered a domain mydomain1.com by a domain provider and I'm using their nameservers.

How to set up the DNS records such that any user going on http://www.mydomain1.com will be transparantly directed to my website, with Apache ? (the browser will probably default to port 80, is that right?)


I initially thought about such a DNS record:

Name                TTL     Type    Priority    Content     
*.mydomain1.com     3600    A       0           123.123.123.123

but then, I think I would have to access the website with http://www.mydomain1.com:7010 (which is not nice) and not http://www.mydomain1.com (which would be better).

Unfortunately you cannot specify ports on DNS records. The only way to make it work as you expect is to have a reverse proxy running elsewhere ( nginx , haproxy ), listening on port 80, and then forward traffic to your server.

Some useful information about HTTP proxying with nginx:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM