通过Internet访问XAMPP中的多个站点(非本地主机) [英] Accessing Multiple Sites in XAMPP over Internet (Not Localhost)

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

问题描述

我正在使用XAMPP网络服务器。

I am using XAMPP web server.

我创建了许多虚拟主机。

I have created many virtual hosts.

NameVirtualHost *:80

<VirtualHost *:80>
  DocumentRoot "E:/Servers/Server1"
  ServerName localhost
</VirtualHost>

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "E:/Servers/Server2"
    ServerName local2

    <Directory "E:/Servers/Server2">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

我可以分别在本地网络中访问两个网站localhost和local2。

I can acess both websites in my local network as localhost and local2 respectively.

使用我的外部IP,我只能通过互联网访问我的第一个网站。

With my external IP, I can only access my first website over Internet.

但我的问题是,我怎么能通过互联网访问我的所有虚拟主机(虽然两者都有相同的IP),来自WAN中不同网络的另一台计算机?

But my question is, how can I access my all virtual hosts over Internet (though both have same IP), from another computer over different network in WAN?

我没有找到任何解决方案对此。

I didn't find any solution to this.

是否可以通过互联网访问?

Is it possible to access over Internet?

如果是,请说明详细程序。

If Yes, please explain the detailed procedure.

推荐答案

您也可以通过互联网访问第二个,但为此您需要将其添加到其他计算机主机中文件(位于C:\ Windows \System32 \drivers \ etc):

You can access the second one over the internet as well but for that you will need to add this into the other computer hosts file (located in C:\Windows\System32\drivers\etc):

您的内部IP地址local2

your internal IP address local2

示例:
192.168.1.65 local2

Example: 192.168.1.65 local2

这是我此刻知道的唯一方式,如果还有另一种解决方案,不需要修改另一台计算机的主机文件,这对我来说也很有意思。

This is the only way I know at this moment, if there is another solution that does no require to modify the hosts file of the other computer it will be interesting for me as well.

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

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