我找遍了所有地方,以更改Apache的DocumentRoot,但没有成功。

时间:2022-10-06 09:45:04

I don't know what I am doing wrong but I can't change the directory of my localhost files with Apache. I tried all kinds of things with httpd.conf, including changing "Order allow,deny" to "Require all granted". It still doesn't work.

我不知道我做错了,但我不能改变我的本地主机的目录文件与Apache。我和httpd尝试各种各样的东西。设计,包括改变“秩序允许,拒绝”“要求所有理所当然”。它仍然不工作。

I'm running Windows 7 64-bit and I'm trying to get Apache to work but all solutions so far have not helped me change DocumentRoot due to error 403.

我正在运行Windows 7 64位,我正在尝试让Apache工作,但是到目前为止,所有的解决方案都没有帮助我修改DocumentRoot,因为错误403。

Here is the httpd.conf

这是httpd . conf

Here is my error log since the latest service restart

这是我的错误日志,因为最新的服务重新启动。

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

2 个解决方案

#1


1  

A configuration like this should work:

这样的配置应该可以:

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

Don't forget to restart the server after you have made any changes to your httpd.conf file. I would also try to temporary remove any existing .htaccess file located in the C:/www folder.

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

To check that the syntax of your configuration file is correct use the -t option:

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

httpd -t

You can also check the logs/error.log to get a better description of what went wrong.

您还可以检查日志/错误。log以更好地描述哪里出了问题。

References

引用

Installing Apache 2.2 on Microsoft Windows

在Microsoft Windows上安装Apache 2.2。

#2


0  

Firstly change the httpd.conf file

首先改变httpd。配置文件

DocumentRoot "c:/www"
<Directory "c:/www">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

then open the "\conf\extra\httpd-vhosts.conf" file.

然后打开“\ conf \额外\ httpd-vhosts。conf”文件。

<VirtualHost *:80>
    DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
</VirtualHost>

To

<VirtualHost *:80>
    DocumentRoot "C:\www"
</VirtualHost>

Finally restart your apache web server and you are good to go..

最后重新启动您的apache web服务器,您就可以开始了。

#1


1  

A configuration like this should work:

这样的配置应该可以:

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

Don't forget to restart the server after you have made any changes to your httpd.conf file. I would also try to temporary remove any existing .htaccess file located in the C:/www folder.

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

To check that the syntax of your configuration file is correct use the -t option:

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

httpd -t

You can also check the logs/error.log to get a better description of what went wrong.

您还可以检查日志/错误。log以更好地描述哪里出了问题。

References

引用

Installing Apache 2.2 on Microsoft Windows

在Microsoft Windows上安装Apache 2.2。

#2


0  

Firstly change the httpd.conf file

首先改变httpd。配置文件

DocumentRoot "c:/www"
<Directory "c:/www">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

then open the "\conf\extra\httpd-vhosts.conf" file.

然后打开“\ conf \额外\ httpd-vhosts。conf”文件。

<VirtualHost *:80>
    DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
</VirtualHost>

To

<VirtualHost *:80>
    DocumentRoot "C:\www"
</VirtualHost>

Finally restart your apache web server and you are good to go..

最后重新启动您的apache web服务器,您就可以开始了。