WAMP服务器您的项目网址无效&不工作

时间:2017-10-27 18:46:21

标签: windows-7 wampserver

我安装了最新的 x64 wamp服务器:wampserver3.1.0_x64.exe Windows 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/&gt;您的项目区&gt; php_test&gt;它的链接是这样的&gt; http://php_test:8080/&gt;这不起作用&amp;无效。
真正的链接是:http://localhost:8080/php_test
我该如何解决这个问题呢? 我找到了下面的链接:
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.我如何修复无效链接?
 2.如何使虚拟主机可用? 评论后编辑&gt;这是我的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
#
#

1 个答案:

答案 0 :(得分:1)

您的HOSTS文件基本上是空的,因为#是评论。

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

主持文件

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

现在,您必须从已启动的命令提示符中重新启动DNS缓存,这是一个管理员&#34;或者只是重新启动电脑

>net stop dnscache

完成后

>net start dnscache

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

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