【发布时间】:2017-10-27 18:46:20
【问题描述】:
我安装了最新的 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/ > 你的项目区 >
php_test > 它的链接是这样的 > http://php_test:8080/ > 这不起作用并且无效。
真正的链接是: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. 如何使虚拟主机可用?
评论后编辑 > 这是我的 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
#
#
【问题讨论】:
-
您是否在 WAMPServer 主页的“工具”菜单上看到名为“添加虚拟主机”的链接。遵循它,它将帮助您正确创建虚拟主机。
-
您是否修改了您的 HOSTS 文件以包含这个新的“phptext”域名?
-
HOSTS 文件需要做哪些更改?
-
向我们展示您的主机文件,有人可能会告诉您。请将其添加到您的问题中,不要将其作为评论发布
-
我编辑我的问题。
标签: windows-7 wampserver