windows - 我到处寻找改变Apache上的DocumentRoot但无济于事

标签 windows apache apache2 http-status-code-403 document-root

我不知道我做错了什么,但我无法使用 Apache 更改本地主机文件的目录。我尝试了 httpd.conf 的各种操作,包括将“Order allowed,deny”更改为 "Require all granted" 。它仍然不起作用。

我正在运行 Windows 7 64 位,并且正在尝试让 Apache 工作,但由于错误 403,到目前为止所有解决方案都无法帮助我更改 DocumentRoot。

这是httpd.conf

这是自最近一次服务重启以来我的错误日志

The Apache2.4 service is restarting. The Apache2.4 service has restarted. m_winnt:notice [pid5304:tid 468] AH00424: Parent: Received restart signal -- Restarting the server.
[Mon Sep 22 22:37:25.315061 2014] [ssl:warn] [pid 5304:tid 468] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Mon Sep 22 22:37:25.315061 2014] [mpm_winnt:notice] [pid 5304:tid 468] AH00455: Apache/2.4.10 (Win32) OpenSSL/1.0.1h configured -- resuming normal operations
[Mon Sep 22 22:37:25.315061 2014] [mpm_winnt:notice] [pid 5304:tid 468] AH00456: Apache Haus VC9 Server built: Jul 15 2014 20:34:18
[Mon Sep 22 22:37:25.315061 2014] [core:notice] [pid 5304:tid 468] AH00094: Command line: 'C:\\Apache24\\bin\\httpd.exe -d C:/Apache24'
[Mon Sep 22 22:37:25.317061 2014] [mpm_winnt:notice] [pid 5304:tid 468] AH00418: Parent: Created child process 3648
[Mon Sep 22 22:37:26.075104 2014] [ssl:warn] [pid 3648:tid 344] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Mon Sep 22 22:37:26.265115 2014] [mpm_winnt:notice] [pid 6612:tid 348] AH00364: Child: All worker threads have exited.
[Mon Sep 22 22:37:26.372121 2014] [ssl:warn] [pid 3648:tid 344] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Mon Sep 22 22:37:26.375121 2014] [mpm_winnt:notice] [pid 3648:tid 344] AH00354: Child: Starting 64 worker threads.
[Mon Sep 22 22:43:06.157556 2014] [autoindex:error] [pid 3648:tid 1052] [client ::1:53336] AH01276: Cannot serve directory C:/Apache24/htdocs/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive

最佳答案

这样的配置应该可以工作:

DocumentRoot "C:/www"
<Directory "C:/www">
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

httpd.conf 文件进行任何更改后,请不要忘记重新启动服务器。我还会尝试临时删除位于 C:/www 文件夹中的任何现有 .htaccess 文件。

要检查配置文件的语法是否正确,请使用 -t 选项:

httpd -t

您还可以检查 logs/error.log 以更好地描述出现的问题。

引用文献

Installing Apache 2.2 on Microsoft Windows

关于windows - 我到处寻找改变Apache上的DocumentRoot但无济于事,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25987395/

相关文章:

windows - Archive::Any 给出 IO 错误

eclipse - 使用eclipse在xampp中配置Apache tomcat

proxy - 处理 https 的 Apache 转发代理

http - 由于生产中的 STS 规则,开发站点重定向到 https

c++ - OpenProcessToken 在 ImpersonateLoggedOnUser 后失败

powershell - 在使用桌面应用程序转换器将我的 win32 应用程序转换为 UWP 应用程序时,如何在 appxmanifest 的发布者名称中添加逗号

c - 输出数量大于应有的数量 - gcc 编译

apache - mod_proxy : when proxying tomcat from apache on 8443, 是需要的 tomcat 证书

apache - 将 http 重定向到 APACHE 站点中某个页面的 https

Apache2 错误日志