创建一个指向不同于80端口的IP的域名 [英] create a domain name pointing to an IP of port different than 80

查看:156
本文介绍了创建一个指向不同于80端口的IP的域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用域名来指向本地服务器IP地址上的网页。但是,问题在于该页面链接到在端口8088上设置的IP地址而不是80,因为后者已被另一个网页使用。通过域名公司,我被告知他们不能这样做,因为域只能指向在端口80上设置的IP地址。所以现在我处于僵局。我有什么替代方案,我如何使域名指向IP:8088?



谢谢

解决方案

您与之交谈的域名公司可能在解释域的工作方式方面做得很差。域名不会引用特定的端口。他们只是指IP地址。客户端可以查找主机名以获取客户端应连接的IP地址,但客户端必须在没有DNS帮助的情况下找出端口。端口80只是HTTP服务的默认端口。



如果您愿意,您当然可以在端口8088上运行Web服务器。端口号必须出现在URL中,例如 http://somehost.example.com:8080/some/page 。客户端会解析并知道连接到端口8088而不是默认端口80.



如果您不希望URL包含端口号,那么请求将会发送要转到默认端口80,并且您别无选择,只能让运行在端口80上的Web服务器处理这些请求。 HTTP / 1.1请求包括客户想要联系的主机名,现代Web服务器程序通常能够根据请求中的主机名提供完全不同的内容集。有几种方法可以满足您的需求:


  1. 只需将Web服务器配置为端口80即可处理这两个站点。这将取决于您使用的Web服务器软件。例如,Apache调用这些虚拟主机,这里是一组示例一>。这是一个典型的解决方案,有些人通过这种方式在同一台服务器上运行数百个站点。

  2. 按计划运行您的两台Web服务器。将端口80的服务器设置为第二个网站的反向代理。服务器将继续为其现在处理的网站提供内容。当它收到第二个站点的请求时,它会将请求转发到端口8088上运行的服务器,并将服务器的响应转发回客户端。 >将现有服务器的端口80移到其他端口。在端口80上运行一个纯粹的反向代理服务器,将这两个网站的请求转发到它们各自的Web服务器。

您可能会更好地向 https://webmasters.stackexchange.com/ https://serverfault.com/


I would like to use a domain name to point to a web page on the local server's IP address. However, the problem is that the page is linked to an IP address set up on port 8088 rather than 80 because the latter is already used by another web page. By the domain company I was told that they cannot do it because the domain can only point to an IP address set up on port 80. So now I am in a deadlock. What alternatives do I have and how can I make a domain pointing to the IP:8088?

Thanks

解决方案

The domain company that you talked to may have done a poor job of explaining how domains work. Domain names don't refer to specific ports. They just refer to IP addresses. The client can look up a hostname to get the IP address which the client should connect to, but the client has to figure out the port without the help of DNS. Port 80 is just the default port for HTTP service.

You can certainly run a web server on port 8088 if you like. The port number would have to appear in the URL, e.g. http://somehost.example.com:8080/some/page. Clients would parse this and know to connect to port 8088 instead of the default port 80.

If you don't want URLs to contain the port number, then requests are going to go to the default port 80, and you have no choice but to make the web server running on port 80 handle these requests. HTTP/1.1 requests include the hostname which the client wants to contact, and modern web server programs are normally capable of serving completely different sets of content based on the hostname in the request. There are few ways todo what you need:

  1. Just configure the web server for port 80 to handle both sites. This will depend on what web server software you're using. Apache for example calls these "virtual hosts", and here is a set of examples. This is a typical solution, and some people run hundreds of sites on the same server this way.

  2. Run your two web servers as you planned. Set up the server for port 80 to be a reverse proxy for the second website. The server would continue to serve content for the site it handles now. When it receives a request for the second site, it would relay the request to the server running on port 8088, and relay the server's response back to the client.

  3. Move the existing server for port 80 to a different port. Run a pure reverse proxy server on port 80, relaying requests for both web sites to their respective web servers.

You might be better off taking further questions to https://webmasters.stackexchange.com/ or https://serverfault.com/.

这篇关于创建一个指向不同于80端口的IP的域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆