从另一台计算机访问虚拟主机

Access virtualhost from another computer

首先我想说的是,我已经阅读了其他出现类似问题的主题,但是应用解决方案,none已经操作了我想要的。

我在我的电脑1 IP:192.168.1.217配置了虚拟主机

C:\wamp\bin\apache\Apache2.4.4\conf\extra\httpd-vhosts.conf:

<VirtualHost *: 80>
    ServerAdmin webmaster@sfi.com
    DocumentRoot "c:/wamp/www/sfi"
    <Directory "c:/wamp/www/sfi">
        Options Indexes FollowSymLinks
        AllowOverride All
        Allow from all
    </Directory>
    ServerName sfi
    ErrorLog "logs/sfi-error.log"
    CustomLog "logs/sfi-access.log" common
</VirtualHost>

并且我添加了以下行:

NameVirtualHost *: 80

在文件C:\wamp\bin\apache\Apache2.4.4\conf\httpd.conf中我修改了以下几行:

Include `conf/extra/httpd-vhosts.conf` (remove `#`)

<Directory /> (Grant permissions)
    AllowOverride none
    AllowOverride All
    Order deny, allow
    Allow from all
</Directory>

<Directory "c:/wamp/www"> (Grant permissions)
     Order Deny, Allow
     Deny from all
     Allow from all
</Directory>

最后,我添加到C:\Windows\System32\drivers\etc\hosts

127.0.0.1 sfi

虚拟主机在安装了wamp服务器的机器上完美运行。

在我想访问我的项目的机器上,我设置为 C:\Windows\System32\ drivers\etc\ hosts 以下行:

192.168.1.217 sfi

但不加载我的项目目录。

我是不是做错了什么?

谢谢。

您只是遇到了防火墙问题,完全超出了您的 httpd 配置范围。