WAMP运行两个带有两个静态IP的网站

时间:2017-10-15 22:03:27

标签: wamp

我有一台带有两个静态IP地址的Windows Server 2016

IP-1链接到c:\ wamp \ www中的网站 IP - 2我想链接到c:\ wamp \ www \ site1

中的网站

目前我已使用https://www.virendrachandak.com/techtalk/creating-multiple-virtual-websites-in-wampserver/来创建两个网站,但我遇到的问题都在一个IP范围内

我需要站点A使用localhost或静态IP和站点B来使用它自己的IP,这样我就可以将域指向该IP范围

简而言之

www.siteA.com - 100.0.0.1~ www.siteB.com - 100.0.0.2

我如何实现这一目标,因为目前我必须使用100.0.0.1/site1获取站点B,使用100.0.0.1获取站点A

1 个答案:

答案 0 :(得分:0)

我找到了在WAMP服务器上运行指向两个不同IP地址的两个网站的解决方案

我已经更改了http-vhost文件,如下所示

<VirtualHost *:80> //This I left as * as this was already running on 127.0.0.1 local host, it can be changed to your static IP Address as required
    ServerAdmin admin@localhost
    DocumentRoot "C:/wamp/www"
    ServerName localhost
    ServerAlias www.localhost.com
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" common
</VirtualHost>

<VirtualHost 154.*.166.*:80> //this can be your second IP address you directing to
    DocumentRoot "C:/wamp/www/etrack"
    ServerName etrack
    ServerAlias **
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" common
</VirtualHost>

我也在主机文件中进行了更改

127.0.0.1       localhost   #eTrack GPS Tracking Software //pointing my first site to local host again
154.*.166.*       etrack        #eTrack Platform Software //pointing my second site to static IP 

可以在以下目录中找到这些文件。

C:\ Windows \ System32 \ drivers \ etc host

C:\瓦帕\ BIN \阿帕奇\ Apache2.4.4 \ CONF \额外