Localhost Forbidden. You do not have permission to access this server.
Introduction:
As a computer enthusiast and a heuristic
problem analyst, I try to see and device every feasible way to proffer
solutions to any problem that may surface, especially when it has to do with me and my computer problems.
Anyway, without further ado, I am going to stop
blabbing and go straight into the reason why you are here reading this blog. This was a personal problem I faced while working on a web application on my demo localhost server. And as I praised myself earlier, I solved it still with my laptop specifications and server settings. So, you might want to follow the exact instructions on this page for a near 100% result.
Problem:
At this point you probably have installed WAMP on
your personal computer and you are trying to access the index.php (i.e. the start or welcome
page) of WAMP through a browser on your system using the regular URL we all know http://localhost, and you are faced with the annoying
FORBIDDEN message as shown on the screenshot below:
The screenshot above has been the annoying
message I have been receiving for over a period of time now. I have actually tried so
many instances- from creating a new access in windows firewall to editing some
configuration files- but to no avail.
But it may surprise you that when I use 127.0.0.1 instead of the URL http://localhost, it works and displays the homepage of
WAMP server as you would expect. See below for a pictur description:
But some detailed functionalities of WAMP may not be granted you since the localhost represents the accepted domain address. But what might be the problem be, you may ask?
But some detailed functionalities of WAMP may not be granted you since the localhost represents the accepted domain address. But what might be the problem be, you may ask?
Technically, the
problem is that, as soon as you install WAMP server on your local Windows 8 system, it adds an
exception of localhost to the host file in the driver folder of the windows
directory.
HOW
TO SOLVE THE PROBLEM:
There are virtually 3 things you may need to do. You
don’t really need to be some computer geek or nerd to do this. Just know how to
find your way around the computer and be able to have the acumen to create
backup files before you begin any sort of operations such as these kinds you
want to embark on. It is obvious that since you’ve started
reading this post, you are a PHP programmer, a web developer or a useful
“computerist”, permit me to use that word.
Under normal condition and specifications, these suggestions are expected to do that which it claims to do. But please not that whatever you do at this point is at your own peril Any damage done whatsoever by you or an accomplice is considered a personal decision taken by you. This blog holds no certainty has to how certain process is to function on users' computer.
Under normal condition and specifications, these suggestions are expected to do that which it claims to do. But please not that whatever you do at this point is at your own peril Any damage done whatsoever by you or an accomplice is considered a personal decision taken by you. This blog holds no certainty has to how certain process is to function on users' computer.
RECOMMENDED REQUIREMENTS:
Operating
System: Windows 8
Application: WAMP 2.2a or later
Computer/Programming Knowledge: Intermediate
Server: Localhost
Backup: Compulsory
Application: WAMP 2.2a or later
Computer/Programming Knowledge: Intermediate
Server: Localhost
Backup: Compulsory
Option
1,
You’ll need to go straight to the following
directory on your windows 8 computer. C:\Windows\System32\Drivers\etc\
Copy the file “hosts” and paste it on your desktop for convenience. You are doing
this so that you can successfully save changes to the file you are going edit.
You might want to ask, "why can’t I edit the file directly in its location, you may ask?"
The reason is this: you may not be granted administrative privilege to edit files in the windows directory even though you are logged in as an administrator. And it is under this login/access level that you can actually save edited files directly in the windows directory. Got that?
You might want to ask, "why can’t I edit the file directly in its location, you may ask?"
The reason is this: you may not be granted administrative privilege to edit files in the windows directory even though you are logged in as an administrator. And it is under this login/access level that you can actually save edited files directly in the windows directory. Got that?
Now, after pasting the file on the desktop, right-click
on the file and open it with notepad on your windows computer. Locate a
line with the code # :: 1 Localhost, and totally eradicate this code line. What I
mean is, immediately delete this line from the file and save it. For those of you that has some soft/hard core knowledge of php, you will see that the hash tag (#) represents a single description line.
Now that you have saved the alteration, copy the file on your desktop and replace it with the one in the C:\Windows\System32\Drivers\etc\ directory.
Now that you have saved the alteration, copy the file on your desktop and replace it with the one in the C:\Windows\System32\Drivers\etc\ directory.
Exit your WAMP server from the task pane
and start it again. When it turns green, open your browser and try the URL http://localhost. There you go!
Read on if OPTION 1 did not work for you.
Read on if OPTION 1 did not work for you.
Option
2:
Ok, option 1 didn't work. Lets move on. This option can be an alternative or an
addition to the first option. When you start WAMP server and the icon on the task pane turns
green as shown below,

click on the green WAMP icon and locate the httpd.conf file link following the Apache drop forward menu. Check the screenshot below for further understanding.
Locate a line with Listen 80 and change it
to Listen
0.0.0.0:80. Then move downward in the file some more and locate
<Directory />
Options FollowSymLinks
AllowOverride all
Order deny,allow
Deny from all (line to change)
AllowOverride all
Order deny,allow
Deny from all (line to change)
</Directory>
And change the last line “Deny from all” to
“Allow from all”. It should then read as shown below:
<Directory />
Options FollowSymLinks
AllowOverride all
Order deny,allow
Allow from all (changed line)
AllowOverride all
Order deny,allow
Allow from all (changed line)
</Directory>
If this is done, you can save the file and
restart your WAMP server as explained above.
Open your browser and type http://localhost. This
should fix the trouble.
Option 3:
It is unfortunate that you are reading this
option. If you are, it is an evident that your WAMP server can still not be
accessed through http://localhost. Well, not to
worry!
Who says you must be stuck with WAMP server when there are other alternatives.
Who says you must be stuck with WAMP server when there are other alternatives.
There is a complete suite like WAMP server.
It behaves like WAMP, works like WAMP, open-sourced like WAMP server and even
sophisticated if not more than WAMP server. It is called WAMPstack, a product
of BITNAMI. You can find this product
for free at www.bitnami.org. I will bring
up a piece on how to effectively use BITNAMI WAMPstack soon.
I hope this piece has in one way on the other helped you.
Please leave a comment below to indicate how well it has helped you or what you think should be done to improve.
No comments:
Post a Comment
Tell me what you think...