简体   繁体   English

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

[英]http://localhost not working correctly on WAMP

I already tried the answered WAMP-localhost-questions, unfortuantely without success. 我已经尝试了回答的WAMP-localhost问题,不幸的是没有成功。

I installed WAMPSERVER 2.4.4 on my machine (Windows 7) and I am not able to correctly link the Bootstrap-CSS-files of a website, I am working on. 我在计算机(Windows 7)上安装了WAMPSERVER 2.4.4,但我无法正确链接正在处理的网站的Bootstrap-CSS文件。 When I am accessing the site via localhost (localhost/netwerken/index.htm), the html is displaying, but the styles are completely broken. 当我通过localhost(localhost / netwerken / index.htm)访问站点时,正在显示html,但是样式已完全损坏。

The WAMP-Server is displayed as "server ONLINE" and uses port 80: WAMP服务器显示为“服务器联机”,并使用端口80:

在此处输入图片说明

I am using an absolute path to link to the CSS-stylesheets: 我正在使用绝对路径链接到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 displays the following error-message: Apache_error显示以下错误消息:

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

I also tried to change the port to 8080 and still get the same error. 我也尝试将端口更改为8080,但仍然收到相同的错误。 WAMP automatically forces me to execute as an Admin. WAMP会自动强制我以管理员身份执行。

Could you please point me in the right direction, what went wrong? 您能指出正确的方向吗,出了什么问题?

How can I change file permissions? 如何更改文件权限?

For others who are having this issue on Windows platforms, the problem may be that the files have the encrypt bit set. 对于在Windows平台上遇到此问题的其他人,问题可能是文件设置了加密位。

See this link for a full explanation and solution. 请参阅此链接以获取完整的说明和解决方案。

This is windows, file permissions are not going to be the problem. 这是Windows,文件权限不会成为问题。

The problem will be in your httpd.conf and the security setting 问题出在您的httpd.conf和安全设置中

Here is the clue client ::1:50536] . 这是线索client ::1:50536] Its using a IPV6 ip address, so my guess would be that you are not allowing access from the loopback address ::1 它使用IPV6 ip地址,因此我的猜测是您不允许从回送地址:: 1进行访问

To prove I am on the right track if you use this address in your browser it should work http://127.0.0.1/netwerken/index.php ... assuming you are running a script called index.php, if not use the one you are running. 为了证明如果您在浏览器中使用此地址,我走在正确的轨道上,它应该可以正常运行http://127.0.0.1/netwerken/index.php ...假设您正在运行名为index.php的脚本,如果不使用您正在运行一个。

First check that your c:\\windows\\system32\\drivers\\etc\\hosts file contains these 2 lines 首先检查您的c:\\ windows \\ system32 \\ drivers \\ etc \\ hosts文件是否包含这两行

127.0.0.1  localhost
::1     localhost

Then check your httpd.conf ( use the wampmanager menus to edit it so you get the correct file ) 然后检查您的httpd.conf(使用wampmanager菜单进行编辑,以便获取正确的文件)

Look for this section, its using older APache 2.2 syntax. 查找本节,它使用较旧的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>

And change it to 并将其更改为

<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 , some errors got released in WampServer 2.4 and this should tell you how to fix them 我建议您也阅读此书,WampServer 2.4中发布了一些错误,这应该告诉您如何修复它们

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM