从Internet访问XAMPP Localhost [英] Access XAMPP Localhost from Internet

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

问题描述

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

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.

完成所有这些操作后,您的朋友现在应该可以通过以下方式访问您的网页:在计算机上转到其网络浏览器,然后输入此处).

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 Localhost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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