http:// localhost在WAMP上无法正常工作

时间:2013-12-12 14:53:47

标签: css localhost wamp

我已经尝试过WAMP-localhost问题,但是很不成功。

我在我的机器上安装了WAMPSERVER 2.4.4(Windows 7),我无法正确链接网站的Bootstrap-CSS文件,我正在努力。当我通过localhost(localhost / netwerken / index.htm)访问该站点时,html正在显示,但样式完全被破坏。

WAMP-Server显示为“服务器联机”并使用端口80:

enter image description here

我使用绝对路径链接到CSS样式表:

<!-- Bootstrap core CSS -->
<link href="http://localhost/netwerken/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="http://localhost/netwerken/css/offcanvas.css" rel="stylesheet">

Apache_error显示以下错误消息:

client ::1:50536] AH00132: file permissions deny server access: C:/wamp/www/netwerken/css/bootstrap.min.css, referer: http://localhost/netwerken/

我还尝试将端口更改为8080并仍然得到相同的错误。 WAMP会自动强制我以管理员身份执行。

请你指出我正确的方向,出了什么问题?

如何更改文件权限?

2 个答案:

答案 0 :(得分:1)

对于在Windows平台上遇到此问题的其他人,问题可能是文件设置了加密位。

有关完整说明和解决方案,请参阅this link

答案 1 :(得分:0)

这是Windows,文件权限不会成为问题。

问题出在你的httpd.conf和安全设置

以下是线索client ::1:50536]。它使用IPV6的IP地址,所以我的猜测是你不允许从环回地址访问:: 1

如果您在浏览器中使用此地址,为了证明我在正确的轨道上,它应该有效http://127.0.0.1/netwerken/index.php ...假设您正在运行名为index.php的脚本,如果不使用您正在运行的脚本。

首先检查您的c:\ windows \ system32 \ drivers \ etc \ hosts文件是否包含这两行

127.0.0.1  localhost
::1     localhost

然后检查你的httpd.conf(使用wampmanager菜单进行编辑,以便得到正确的文件)

查找此部分,使用较旧的APache 2.2语法。

<Directory "d:/wamp/www">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
#    Require all granted
#   onlineoffline tag - don't remove
     Order Deny,Allow
     Deny from all
     Allow from 127.0.0.1
     Allow from ::1
     Allow from localhost
</Directory>

并将其更改为

<Directory "d:/wamp/www">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    #   onlineoffline tag - don't remove
    Require local
    # Apache 2.4 syntax for any of the addresses 127.0.0.1 or ::1 or localhost
</Directory>

I suggest you read this as well,在WampServer 2.4中发布了一些错误,这应该告诉你如何修复它们