Windows网络上的apache-无法从网络中连接到外部ip [英] apache on windows network - can't connect to external ip from in network

查看:69
本文介绍了Windows网络上的apache-无法从网络中连接到外部ip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个AMP Web应用程序,该应用程序最初将由传统的第三方主持人提供.

I created an AMP web application that was originally going to be served from a traditional 3rd party host.

完成后,客户端决定在内部将其托管在其办公网络中的服务器上.该应用程序仅供工作人员使用,但是这些工作人员通常会不在现场.我没有参与建立他们的网络的工作,该网络至少使用一台运行Windows Server 2003的服务器.我看到的客户端计算机是XP.

As we finished up, the client decided to host it internally, on a server in their office network. The application is only meant to be available to staff members, but those staff members will often be off-site. I had no involvement in setting up their network, which uses at least one server running windows server 2003. The client machines I saw were XP.

我在Server 2003机器上设置了Apache,MySQL和PHP,并安装了该应用程序.该应用程序是基于CodeIgniter框架构建的,因此我将base_url设置为内部IP(192.168 ...),然后在网络内部进行了测试.一切正常.

I set up Apache, MySQL and PHP on the server 2003 machine, and installed the application. The application is built on the CodeIgniter framework, so I set the base_url to the internal IP (192.168...), and we tested from within the network. Everything worked fine.

接下来,我们请他们的网络人员打开80端口以获取Apache.我将base_url设置为外部IP,并在家里进行了测试(使用外部IP作为网址),

Next, we asked their network guy to open port 80 for apache. I set the base_url to the external IP, and tested from my home (using the external IP as the web address), and it works fine.

但是,当尝试从网络内部使用外部IP访问应用程序时,它们无法连接.我可以将base_url重置为网络IP,他们可以使用网络IP对其进行访问,但是在外部连接时应用程序将失败(因为在整个应用程序中使用的base_url指向内部IP).

However, when attempting to access the application using the external IP from within the network, they're unable to connect. I can reset the base_url to the network IP, and they can access it using the network IP, but then it the application fails when connecting externally (since the base_url, used throughout the application, is pointing to the internal IP).

假设我可以让CodeIgniter确定base_url(通过将变量保留为空字符串),而是宁愿弄清楚外部IP在网络中失败的原因,并尝试对其进行纠正.

It suppose I could let CodeIgniter determine the base_url (by leaving the variable as an empty string), but would rather figure out why the external IP fails in-network, and try to correct that.

我们使用的服务器不是专用于AMP堆栈的(实际上,它还有至少一个其他应用程序必须使用IIS广播到Internet,以及用于办公室扫描仪的FTP服务器),所以我想那里可能有一些冲突.

The server we're using is not dedicated to the AMP stack (in fact, it has at least one other application broadcasting to the internet that must have been using IIS, as well as an FTP server used for office scanners), so I suppose there might be some conflicts there.

我对Windows网络了解甚少.快速搜索表明这可能是由于NAT引起的,但没有提供解决方法.

I know very little about windows networking. A quick search suggested this might be because of NAT, but didn't offer a work-around.

他们的网络人没有任何建议,并说一切都很好.

Their network guy has no suggestions, and said that everything should be fine.

是否可以让网络内部的用户使用外部IP访问Apache服务器,如果可以,启用该IP地址需要做什么?

Is it possible to have users inside the network access the Apache server using the external IP, and if so, what needs to happen to enable that?

TYIA

推荐答案

这与Apache不相关,也不与CI相关.通常不可能从网络内部访问外部IP地址.

This isn't Apache related, nor is it CI related. It's often impossible to reach the external IP address from within the network.

坦率地说,我不知道为什么会这样.我确实知道这与NAT(网络地址转换)的工作方式或至少与实现方式有关.

Frankly, I don't know exactly why that is. I do know that it's related to how NAT (Network Address Translation) works or at least how it's implemented.

要详细了解为什么 ,您应该在 serverfault 上询问此问题.如果您只是需要处理它的程序员,请接受NAT通常仅从内部到外部以及从外部到内部工作,而不能从内部到内部工作.

For a detailed overview of why this is, you should ask this question on serverfault. If you're simply a programmer who has to deal with it, accept that NAT usually works only from inside to outside and outside to inside, but not inside to inside.

您已经提到了问题中的一种解决方案-请勿使用 base_url .您也可以仅在外部IP地址(而不是公司IP,但可以说是数据中心之类)上运行服务器.

You already mentioned one of the solutions in your question - don't use base_url. You could also simply run the server on an external IP address (not your company IP, but let's say a datacenter or something).

这篇关于Windows网络上的apache-无法从网络中连接到外部ip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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