Apache正在侦听不同的端口,但是如何获取它所以我不必输入端口号?

时间:2023-02-09 09:10:34

I am running IIS and Apache HTTP Server side-by-side on my localhost machine, and Apache is listening on a different port (port 81). IIS is listening to port 80. However, I can only get to my virtual domains for Apache if I type in that port number. So for instance:

我在我的localhost机器上并行运行IIS和Apache HTTP Server,而Apache正在侦听另一个端口(端口81)。 IIS正在侦听端口80.但是,如果输入该端口号,我只能访问Apache的虚拟域。例如:

http://virtual.myvirtualdomain.com:81 http://virtual.myvirtualdomain2.com:81

How can I make it so Apache automatically knows it is port 81, and does not force me to type in the port number?

我怎么能这样做,所以Apache自动知道它是81端口,并没有强迫我输入端口号?

EDIT:

The answer appears to be that I need to redirect IIS to Apache. Can anyone provide clarification on how that is done with IIS 5.1?

答案似乎是我需要将IIS重定向到Apache。任何人都可以澄清如何使用IIS 5.1完成这项工作吗?

8 个解决方案

#1


It's not a matter of telling Apache, it's a matter of the browser knowing what to connect to. You're either going to have to have IIS redirect to Apache, or give up.

这不是告诉Apache的问题,而是浏览器知道要连接到什么的问题。您要么必须将IIS重定向到Apache,要么放弃。

#2


You have to type in the port number so your client knows where to connect to. This has nothing to do with the server.

您必须输入端口号,以便客户端知道连接的位置。这与服务器无关。

On Unix systems you might be able to modify your /etc/services to list 81 as port for http. But that would effectively disable access to all websites that are located on port 80.

在Unix系统上,您可以将/ etc / services修改为列表81作为http的端口。但这将有效地禁止访问位于端口80上的所有网站。

Alternatively you can configure your IIS on port 80 to locally proxy requests for the sites which are on apache. Then all clients would ask the IIS for a page, which would make a local connection to port 81.

或者,您可以在端口80上配置IIS以本地代理对Apache上的站点的请求。然后,所有客户端都会向IIS请求一个页面,该页面将与端口81建立本地连接。

#3


I did some more research and it turns out that you can't redirect IIS 5.1 to Apache because that would require multiple Web sites (setup as redirects to the virtual hosts on Apache on port 81). This is because IIS 5.1 on Windows XP Pro can't do multiple Web sites (running at the same time without the scripting hack). Oh well.

我做了一些研究,结果发现你无法将IIS 5.1重定向到Apache,因为这需要多个网站(设置为重定向到端口81上Apache上的虚拟主机)。这是因为Windows XP Pro上的IIS 5.1无法执行多个Web站点(在没有脚本黑客的情况下同时运行)。那好吧。

#4


How about you swap it? Make Apache listen on port 80, IIS on port 81 for whatever you need and have Apache redirect? Apache shouldn't be restricted to the same one-website per machine that IIS 5.1 is.

你怎么换掉它?让Apache监听端口80,端口81上的IIS,无论您需要什么,并进行Apache重定向?不应将Apache限制为IIS 5.1所在的每台计算机上的同一个网站。

#5


You can't. The 81 is telling your browser where to look for Apache.

你不能。 81告诉你的浏览器在哪里寻找Apache。

#6


You can't.

It's the job of your web client to specify the port, and until you do specify that port it won't even reach Apache.

您的Web客户端的工作是指定端口,并且在您指定该端口之前它甚至不会到达Apache。

What you could potentially do is have IIS also listen for the same HTTP/1.1 virtual hosts, and then arrange for it to issue a 302 Moved redirect to send your browser to the right port number.

你可能做的是让IIS也监听相同的HTTP / 1.1虚拟主机,然后安排它发出302 Moved重定向,将你的浏览器发送到正确的端口号。

Alternatively, run a second IP address on your machine, and bind IIS to the original IP address and Apache to the second. That way you don't need to use different ports at all.

或者,在您的计算机上运行第二个IP地址,并将IIS绑定到原始IP地址,将Apache绑定到第二个IP地址。这样你根本不需要使用不同的端口。

#7


There is no way to do exactly what you ask. About the only way would be to configure IIS -- for the virtual domains being served by IIS -- to forward to Apache on port 81. With this configuration, the client would not be aware that their requests were passing through IIS on their way to Apache. A little less efficient, but it would solve your needs.

没有办法完全按照你的要求去做。关于唯一的方法是将IIS(由IIS提供服务的虚拟域)配置为在端口81上转发到Apache。使用此配置,客户端不会意识到他们的请求在前往IIS的途中通过IIS Apache的。效率稍低,但它可以解决您的需求。

#8


When an url is typed, there is a certain port that the browser has to use to connect to the site. 80 is the default port that the server checks. If you need to connect to any other port via a browser, you would need to have the port number in the url. It is not apache that is forcing you to type 81, but rather your browser because it is set to use 80 as the port when a port number is not specified.

输入网址时,浏览器必须使用某个端口连接到网站。 80是服务器检查的默认端口。如果您需要通过浏览器连接到任何其他端口,则需要在URL中包含端口号。它不是强制你输入81的apache,而是你的浏览器,因为当没有指定端口号时,它被设置为使用80作为端口。

If you were to change apache's port to 80 and IIS port to 81, then you be able to connect to apache without the port number but you will need to use the port number when using the IIS webserver.

如果您要将apache的端口更改为80并将IIS端口更改为81,则可以在没有端口号的情况下连接到apache,但在使用IIS Web服务器时需要使用端口号。

Not sure what the others idea is behind using apache to redirect to IIS. It sounds like to me that if you make an entry in httpd.conf of apache for IIS directory, then you be using apache to connect to the directory, not IIS. You could set up a domain and have it connect to apache via port 81. That is one way to hide the port number (might be not true. I have never tried apache on port other than 80).

不确定使用apache重定向到IIS后面的其他想法是什么。对我来说,如果你在apache的httpd.conf中为IIS目录创建一个条目,那么你使用apache连接到目录,而不是IIS。你可以设置一个域,让它通过端口81连接到apache。这是隐藏端口号的一种方法(可能不是真的。我从来没有尝试过80以外的端口上的apache)。

#1


It's not a matter of telling Apache, it's a matter of the browser knowing what to connect to. You're either going to have to have IIS redirect to Apache, or give up.

这不是告诉Apache的问题,而是浏览器知道要连接到什么的问题。您要么必须将IIS重定向到Apache,要么放弃。

#2


You have to type in the port number so your client knows where to connect to. This has nothing to do with the server.

您必须输入端口号,以便客户端知道连接的位置。这与服务器无关。

On Unix systems you might be able to modify your /etc/services to list 81 as port for http. But that would effectively disable access to all websites that are located on port 80.

在Unix系统上,您可以将/ etc / services修改为列表81作为http的端口。但这将有效地禁止访问位于端口80上的所有网站。

Alternatively you can configure your IIS on port 80 to locally proxy requests for the sites which are on apache. Then all clients would ask the IIS for a page, which would make a local connection to port 81.

或者,您可以在端口80上配置IIS以本地代理对Apache上的站点的请求。然后,所有客户端都会向IIS请求一个页面,该页面将与端口81建立本地连接。

#3


I did some more research and it turns out that you can't redirect IIS 5.1 to Apache because that would require multiple Web sites (setup as redirects to the virtual hosts on Apache on port 81). This is because IIS 5.1 on Windows XP Pro can't do multiple Web sites (running at the same time without the scripting hack). Oh well.

我做了一些研究,结果发现你无法将IIS 5.1重定向到Apache,因为这需要多个网站(设置为重定向到端口81上Apache上的虚拟主机)。这是因为Windows XP Pro上的IIS 5.1无法执行多个Web站点(在没有脚本黑客的情况下同时运行)。那好吧。

#4


How about you swap it? Make Apache listen on port 80, IIS on port 81 for whatever you need and have Apache redirect? Apache shouldn't be restricted to the same one-website per machine that IIS 5.1 is.

你怎么换掉它?让Apache监听端口80,端口81上的IIS,无论您需要什么,并进行Apache重定向?不应将Apache限制为IIS 5.1所在的每台计算机上的同一个网站。

#5


You can't. The 81 is telling your browser where to look for Apache.

你不能。 81告诉你的浏览器在哪里寻找Apache。

#6


You can't.

It's the job of your web client to specify the port, and until you do specify that port it won't even reach Apache.

您的Web客户端的工作是指定端口,并且在您指定该端口之前它甚至不会到达Apache。

What you could potentially do is have IIS also listen for the same HTTP/1.1 virtual hosts, and then arrange for it to issue a 302 Moved redirect to send your browser to the right port number.

你可能做的是让IIS也监听相同的HTTP / 1.1虚拟主机,然后安排它发出302 Moved重定向,将你的浏览器发送到正确的端口号。

Alternatively, run a second IP address on your machine, and bind IIS to the original IP address and Apache to the second. That way you don't need to use different ports at all.

或者,在您的计算机上运行第二个IP地址,并将IIS绑定到原始IP地址,将Apache绑定到第二个IP地址。这样你根本不需要使用不同的端口。

#7


There is no way to do exactly what you ask. About the only way would be to configure IIS -- for the virtual domains being served by IIS -- to forward to Apache on port 81. With this configuration, the client would not be aware that their requests were passing through IIS on their way to Apache. A little less efficient, but it would solve your needs.

没有办法完全按照你的要求去做。关于唯一的方法是将IIS(由IIS提供服务的虚拟域)配置为在端口81上转发到Apache。使用此配置,客户端不会意识到他们的请求在前往IIS的途中通过IIS Apache的。效率稍低,但它可以解决您的需求。

#8


When an url is typed, there is a certain port that the browser has to use to connect to the site. 80 is the default port that the server checks. If you need to connect to any other port via a browser, you would need to have the port number in the url. It is not apache that is forcing you to type 81, but rather your browser because it is set to use 80 as the port when a port number is not specified.

输入网址时,浏览器必须使用某个端口连接到网站。 80是服务器检查的默认端口。如果您需要通过浏览器连接到任何其他端口,则需要在URL中包含端口号。它不是强制你输入81的apache,而是你的浏览器,因为当没有指定端口号时,它被设置为使用80作为端口。

If you were to change apache's port to 80 and IIS port to 81, then you be able to connect to apache without the port number but you will need to use the port number when using the IIS webserver.

如果您要将apache的端口更改为80并将IIS端口更改为81,则可以在没有端口号的情况下连接到apache,但在使用IIS Web服务器时需要使用端口号。

Not sure what the others idea is behind using apache to redirect to IIS. It sounds like to me that if you make an entry in httpd.conf of apache for IIS directory, then you be using apache to connect to the directory, not IIS. You could set up a domain and have it connect to apache via port 81. That is one way to hide the port number (might be not true. I have never tried apache on port other than 80).

不确定使用apache重定向到IIS后面的其他想法是什么。对我来说,如果你在apache的httpd.conf中为IIS目录创建一个条目,那么你使用apache连接到目录,而不是IIS。你可以设置一个域,让它通过端口81连接到apache。这是隐藏端口号的一种方法(可能不是真的。我从来没有尝试过80以外的端口上的apache)。