2016-04-23 94 views
1

我已经阅读了大量的线程在这里和其他地方,但没有任何建议工作。我在全新安装的Windows Server 2012 R2上安装了最新版本的WAMP 64位。从外部来源禁止WAMP 403

  • 我叫andrewwww目录中创建一个子目录。在那是一个index.html文件。

  • 添加以下到主机文件:

    127.0.0.1 andrew 
    ::1 andrew 
    
  • 添加以下到httpd-vhosts.conf文件:

    <VirtualHost *:80> 
        DocumentRoot "c:/wamp64/www/andrew" 
        ServerName andrew 
        <Directory "c:/wamp64/www/andrew"> 
         Options Indexes FollowSymLinks 
         AllowOverride All 
         Require all granted 
        </Directory> 
    </VirtualHost> 
    
  • 我未注释的虚拟主机线在httpd.conf

  • 我停下来开始网络dnscache
  • 我重新启动WAMP服务
  • 我“放到网上的” WAMP服务器

无论如何,当我从另一台计算机访问该服务器像[server IP address]*/andrew/index.html我得到一个403 Forbidden错误。

这里是Apache的错误日志(“[服务器IP]”真的是服务器的实际IP):

[Fri Apr 22 17:10:32.628356 2016] [mpm_winnt:notice] [pid 4680:tid 424] AH00422: Parent: Received shutdown signal -- Shutting down the server. 
[Fri Apr 22 17:10:34.656507 2016] [mpm_winnt:notice] [pid 4444:tid 312] AH00364: Child: All worker threads have exited. 
[Fri Apr 22 17:10:34.672087 2016] [mpm_winnt:notice] [pid 4680:tid 424] AH00430: Parent: Child process 4444 exited successfully. 
[Fri Apr 22 17:10:34.921723 2016] [auth_digest:notice] [pid 4724:tid 416] AH01757: generating secret for digest authentication ... 
[Fri Apr 22 17:10:34.952892 2016] [mpm_winnt:notice] [pid 4724:tid 416] AH00455: Apache/2.4.17 (Win64) PHP/5.6.16 configured -- resuming normal operations 
[Fri Apr 22 17:10:34.952892 2016] [mpm_winnt:notice] [pid 4724:tid 416] AH00456: Apache Lounge VC14 Server built: Oct 11 2015 11:49:07 
[Fri Apr 22 17:10:34.952892 2016] [core:notice] [pid 4724:tid 416] AH00094: Command line: 'C:\\wamp64\\bin\\apache\\apache2.4.17\\bin\\httpd.exe -d C:/wamp64/bin/apache/apache2.4.17' 
[Fri Apr 22 17:10:34.952892 2016] [mpm_winnt:notice] [pid 4724:tid 416] AH00418: Parent: Created child process 4388 
[Fri Apr 22 17:10:35.140157 2016] [auth_digest:notice] [pid 4388:tid 312] AH01757: generating secret for digest authentication ... 
[Fri Apr 22 17:10:35.171357 2016] [mpm_winnt:notice] [pid 4388:tid 312] AH00354: Child: Starting 64 worker threads. 
[Fri Apr 22 17:10:49.899265 2016] [authz_core:error] [pid 4388:tid 1040] [client 73.82.23.97:57193] AH01630: client denied by server configuration: C:/wamp64/www/andrew/index.html 
[Fri Apr 22 17:10:50.055249 2016] [authz_core:error] [pid 4388:tid 1040] [client 73.82.23.97:57193] AH01630: client denied by server configuration: C:/wamp64/www/favicon.ico, referer: http://[SERVER IP]/andrew/index.html 

现在我想它在Windows 2012服务器上的一些设置的事,但我无法弄清楚。帮帮我。

回答

3

由于Apache不知道将IP地址与虚拟主机相关联,因此它使用主服务器设置。也许你根本不需要虚拟主机,但是试试这个:

<VirtualHost *:80> 
    DocumentRoot "c:/wamp64/www/andrew" 
    ServerName andrew 
    #of course, enter your IP address here 
    ServerAlias 1.2.3.4 
    <Directory "c:/wamp64/www/andrew"> 
     Options Indexes FollowSymLinks 
     AllowOverride All 
     Require all granted 
    </Directory> 
</VirtualHost> 
+0

那么,这在技术上是有效的。 [服务器IP] /andrew/index.html不会,但只需输入http:// [服务器IP]直接进入该文件夹。我希望做的是在www目录中有几个不同的文件夹,并为每个文件夹设置vhost条目,以便用户访问IP /安卓,IP/foobar等。 – Crescent

+1

但是,您已将'DocumentRoot'设置为包含'andrew'文件夹,所以你不要把它放在你的URL中。我想你误解了一个虚拟主机。正如我所说,你可能根本不需要一个。请在[文档](https://httpd.apache.org/docs/current/mod/mod_alias.html)中查找“Alias”命令。正如名称所暗示的,[virtual * host *](https://httpd.apache.org/docs/current/vhosts/)允许您在一台服务器上拥有不同的主机名。 – miken32

+0

啊。我正在阅读一篇文章,说使用虚拟主机而不是别名。当谈到网络时,我承认它是n00b。我是贸易的SQL Server开发人员。这里是我引用的文章:https://stackoverflow.com/questions/23665064/project-links-do-not-work-on-wamp-server/23990618#23990618 – Crescent