简体   繁体   中英

http://localhost not working correctly on WAMP

I already tried the answered WAMP-localhost-questions, unfortuantely without success.

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. When I am accessing the site via localhost (localhost/netwerken/index.htm), the html is displaying, but the styles are completely broken.

The WAMP-Server is displayed as "server ONLINE" and uses port 80:

在此处输入图片说明

I am using an absolute path to link to the CSS-stylesheets:

<!-- 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:

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. WAMP automatically forces me to execute as an Admin.

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.

See this link for a full explanation and solution.

This is windows, file permissions are not going to be the problem.

The problem will be in your httpd.conf and the security setting

Here is the clue 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

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.

First check that your c:\\windows\\system32\\drivers\\etc\\hosts file contains these 2 lines

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 )

Look for this section, its using older APache 2.2 syntax.

<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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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