【问题标题】:http://localhost not working correctly on WAMPhttp://localhost 在 WAMP 上无法正常工作
【发布时间】:2013-12-31 01:19:11
【问题描述】:

我已经尝试了已回答的 WAMP-localhost-questions,不幸的是没有成功。

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

WAMP-Server 显示为“server ONLINE”并使用端口 80:

我正在使用绝对路径链接到 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 会自动强制我以管理员身份执行。

您能否指出正确的方向,出了什么问题?

如何更改文件权限?

【问题讨论】:

  • 更改css文件的权限
  • 另外,由于您在 Windows 上以管理员身份运行 WAMP,因此可能会这样做
  • @pranav-c 哇,看起来就像错误消息! :P
  • @KevinPei WAMP 会自动强制您以管理员身份运行它。还是行不通。如何更改文件权限?
  • 您必须了解文件权限与 Xampp、Apache 或万维网无关。首先,打开 Windows 资源管理器,找到文件/文件夹,右键单击它,选择“属性”并检查“安全”选项卡。

标签: css localhost wamp


【解决方案1】:

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

请参阅this link 以获得完整的解释和解决方案。

【讨论】:

    【解决方案2】:

    这是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 中发布了一些错误,这应该告诉你如何修复它们

    【讨论】:

    • 解决了这个问题。很好的答案。谢谢。
    猜你喜欢
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    • 2021-03-25
    • 2015-04-25
    • 2016-02-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多