WAMP 服务器您的项目 url 无效且不起作用

WAMP Server Your Projects urls are invalid & do n't work

我安装了最新的 x64 wamp 服务器:wampserver3.1.0_x64.exeWindows 7.
我将它的默认 80 端口更改为 8080,因为 IIS & 现在一切正常。
我向这条路径添加了一个简单的项目:C:\wamp64\www 如下所示:

C:\wamp64\www\php_test\index.php

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>

现在当我走这条路时 http://localhost:8080/ > 你的项目区 > php_test > link 是这样的 > http://php_test:8080/ > 那是行不通的,是无效的。
真正的 link 是:http://localhost:8080/php_test
我该如何解决这个问题?
我在下面找到了 link :
Project Links do not work on Wamp Server
我按照答案。
现在新的问题是添加虚拟主机后,phptest又不行了。
这是 httpd-vhosts.conf 文件:

# Virtual Hosts
#
<VirtualHost *:8080>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>


<VirtualHost *:8080>
    ServerName phptest
    DocumentRoot "${INSTALL_DIR}/www/php_test"
    <Directory "${INSTALL_DIR}/www/php_test/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

添加 phptest 到虚拟主机后,我确实重启了所有服务。


我的问题:
1. 如何修复无效的 link?
2. 如何使虚拟主机可用?

评论后编辑 > 这是我的 HOSTS 文件内容:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
#
#

您的 HOSTS 文件基本上是空的,因为 # 是注释。

您必须像这样将对每个 VHOST 的引用添加到您的 HOSTS 文件中,以便浏览器可以找到您的开发域

主机文件

127.0.0.1 localhost
::1       localhost
127.0.0.1 phptest
::1       phptest

现在您必须像这样重新启动 DNS 缓存,从您已经启动的命令提示符 "As an Administrator" 或者只是重新启动 PC

>net stop dnscache

完成后做

>net start dnscache

或者 WAMPServers 菜单上有一个菜单项

[Right Click] wampmanager-> Tools -> Restart DNS