Issue
Environment:
Server: AWS EC2-WINDOWS 2012 R2
Web Server: Apache 2.4.17
The simple web application, is accessible from the server, using the browser with http://localhost/
and http://127.0.0.1/
However, when I try to access it from outside (e.g., client, or any other machine through internet) by placing my ec2 instance public DNS ('ec2-.compute.amazonaws.com') in the browser, I get the following
Now I know this is web server issue. EC2 security rules, and Windows Server firewall have been bypassed. The issue is coming from my Apache server settings.
I spent significant time trying all possible solutions here:
WAMP error: Forbidden You don't have permission to access /phpmyadmin/ on this server
Forbidden: You don't have permission to access / on this server, WAMP Error
Error message “Forbidden You don't have permission to access / on this server”
You don't have permission to access / on this server
I did not create virtual host though. Do I need to?
My current httpd.conf
has the following settings:
<Directory "C:/wamp64/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
What could be the problem?
Solution
So this has taken my whole weekend to figure out. But eventually, I found the solution in this answer. It was like a hidden treasure among many other answers with high votes, for what seems to be a very contentious issue.
I provide an answer here that applies to the particular environment I mentioned in the questions. The changes required on the httpd.conf
file are as follows:
Change
<Directory .... >
to be like this:<Directory "C:/wamp64/www/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Require all granted </Directory>
where my
index.html
file is underwww
apache default directoryAnd this is where I was stuck: In the same file, search for
# onlineoffline tag - don't remove
, below this line you'll findRequire local
. Change it toRequire all granted
.Do not forget to restart Apache server.
Virtual host is irrelevant. Whether you are using Windows server or not. As long you have one website hosted, no need for the virtual host
Being hosted on EC2 is irrelevant. Since you get the
Forbidden
reply, you are bypassed EC2 security group rules, and host server firewall (in this case windows 2012 R2). The response is coming from the web server.
Answered By - Hawk Answer Checked By - Katrina (WPSolving Volunteer)