【问题标题】:Unable to browse virtual host with WAMP无法使用 WAMP 浏览虚拟主机
【发布时间】:2016-05-27 02:31:11
【问题描述】:

我正在开发一个最终将托管在 Linux 机器上的网站。我决定使用 WAMP 作为我的开发服务器,这样我就可以确保我的所有 Angular.js 路由等都能正常工作。

我已经启动并运行了 WAMP(漂亮的绿色托盘图标)。选择了 vhosts 模块。我在 httpd-vhosts.conf 中添加了以下内容:

# mergable.local
<VirtualHost *:80>
    ServerAdmin mike@mahony.us
    DocumentRoot "D:/Main/source/mergable"
    ServerName mergable.local
    ServerAlias www.mergable.local
    ErrorLog "logs/mergable.local-error.log"
    CustomLog "logs/mergable.local-access.log" common
    <Directory "/">
        Deny from all
        Allow from 127.0.0.1
    </Directory>
</VirtualHost>

我还在我的主机文件中添加了以下内容:

127.0.0.1       localhost
127.0.0.1       mergable.local
127.0.0.1   www.mergable.local

当我浏览到 http://www.mergable.local 时,我会看到 WAMP 配置页面。关于我做错了什么有什么想法吗?

【问题讨论】:

  • 这一行 &lt;Directory "/"&gt; 应该是 &lt;Directory "D:/Main/source/mergable"&gt; 或者您将访问 D: 的根目录给任何入侵您网站的人。
  • 如果您使用的是 Apache 2.4。? Deny from all Allow from 127.0.0.1 应该是 Require local
  • hosts文件中的这一行也不需要

标签: apache wamp


【解决方案1】:

检查您的apache\conf\httpd.conf 文件

#LoadModule vhost_alias_module modules/mod_vhost_alias.so

对于

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

如果您在LoadModuleInclude 之前有#,请将其删除,以便虚拟主机配置文件运行。

【讨论】:

  • 好的,所以现在我得到了一个不同的错误。它现在显示“禁止您无权访问此服务器上的 /index.html”。我打赌这与该网站文件夹中的空 .htaccess 文件有关吗? .htaccess 文件中应该包含什么内容?
  • 你有没有 index.html 文件,"D:/Main/source/mergable" ?
  • 是的 index.html 文件在 d:/Main/source/mergable
  • 我不得不将 httpd-vhosts.conf 文件的 DIRECTORY 部分更改为:&lt;Directory "/"&gt;Options Indexes FollowSymLinks Includes ExecCGIAllowOverride AllRequire all grantedDeny from allAllow from 127.0.0.1&lt;/Directory&gt;
  • .htaccess 用于配置指令,更多关于它code.tutsplus.com/tutorials/…
猜你喜欢
  • 2016-02-23
  • 2018-04-23
  • 2011-09-30
  • 2016-01-08
  • 2011-05-20
  • 2013-03-15
  • 2014-07-15
  • 2014-09-20
  • 2018-05-09
相关资源
最近更新 更多