从 Internet 访问 XAMPP 本地主机 [英] Access XAMPP Localhost from Internet

查看:18
本文介绍了从 Internet 访问 XAMPP 本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地笔记本电脑上安装了 XAMPP.而且我有一个几乎静态的IP.我想将 ip 提供给其他人以从他们的浏览器运行它.我配置了 apache httpd-vhosts.conf 来监听我的 ip 地址:80 并将具有 ip 地址和域根的虚拟服务器添加到本地 httdocs 目录和服务器名称为 localhost.阿帕奇没有启动.我应该怎么做才能从外部计算机访问我的网站.

I have XAMPP installed in local laptop. And I have a almost static ip. I would like to give the ip to other to run it from their browser. I configured apache httpd-vhosts.conf to listen my ip address:80 and added the virtual server with the ip address and domain root to local httdocs directory and the servername as localhost. Apache doesn't start. what should I do to access my website from external computer.

推荐答案

首先,您需要配置您的计算机以从路由器获取静态 IP.可以找到有关如何执行此操作的说明:这里

First, you need to configure your computer to get a static IP from your router. Instructions for how to do this can be found: here

例如,假设您选择了 IP 地址 192.168.1.102.完成上述步骤后,您应该可以通过 http://localhost 访问本地计算机上的网站和 http://192.168.1.102,因为您的计算机现在将始终在您的网络上拥有该 IP 地址.

For example, let's say you picked the IP address 192.168.1.102. After the above step is completed, you should be able to get to the website on your local machine by going to both http://localhost and http://192.168.1.102, since your computer will now always have that IP address on your network.

如果您查找您的 IP 地址(例如 http://www.ip-adress.com/),你看到的IP其实就是你路由器的IP.当你的朋友访问你的网站时,你会给他这个IP.但是,您需要告诉您的路由器,当它收到对网页的请求时,将该请求转发到您的服务器.这是通过端口转发完成的.

If you look up your IP address (such as http://www.ip-adress.com/), the IP you see is actually the IP of your router. When your friend accesses your website, you'll give him this IP. However, you need to tell your router that when it gets a request for a webpage, forward that request to your server. This is done through port forwarding.

这里这里,尽管您看到的确切屏幕会因路由器制造商的不同而有所不同(具体说明请参见 Google, 如果需要的话).

Two examples of how to do this can be found here and here, although the exact screens you see will vary depending on the manufacturer of your router (Google for exact instructions, if needed).

对于我拥有的 Linksys 路由器,我输入 http://192.168.1.1/,输入我的用户名/密码, 应用与游戏选项卡 > 端口范围转发.输入应用程序名称(随便你怎么称呼它)、起始端口(80)、结束端口(80)、协议(TCP)、IP地址(使用上面的例子,你将输入192.168.1.102,这是静态IP您分配了您的服务器),并确保选中以启用转发.重新启动路由器,更改应该会生效.

For the Linksys router I have, I enter http://192.168.1.1/, enter my username/password, Applications & Gaming tab > Port Range Forward. Enter the application name (whatever you want to call it), start port (80), end port (80), protocol (TCP), ip address (using the above example, you would enter 192.168.1.102, which is the static IP you assigned your server), and be sure to check to enable the forwarding. Restart your router and the changes should take effect.

完成所有这些后,您的朋友现在应该能够访问您的网页,方法是转到他机器上的网络浏览器并输入 http://IP.address.of.your.computer(与您访问时看到的相同这里).

Having done all that, your friend should now be able to access your webpage by going to his web browser on his machine and entering http://IP.address.of.your.computer (the same one you see when you go here ).

如前所述,无论您是否离线登录,您的 ISP 分配给您的 IP 地址最终都会改变.我强烈推荐使用完全免费的 DynDns.您可以在他们的域中选择一个主机名(例如 cuga.kicks-ass.net),然后您的朋友可以随时访问您的网站,只需转到 http://cuga.kicks-ass.net 在他的浏览器中.这是他们的网站:DynDns

As mentioned earlier, the IP address assigned to you by your ISP will eventually change whether you sign offline or not. I strongly recommend using DynDns, which is absolutely free. You can choose a hostname at their domain (such as cuga.kicks-ass.net) and your friend can then always access your website by simply going to http://cuga.kicks-ass.net in his browser. Here is their site again: DynDns

我希望这会有所帮助.

这篇关于从 Internet 访问 XAMPP 本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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