Pages: 12Next
Current Page: 1 of 2
403 forbidden when try to go to website
Posted by: joshd (---.dvmercy.com)
Date: May 19, 2015 06:42PM

I have installed wampserver on a windows 7 pc with wordpress and gone through all the steps of using a virtual host. The problem I'm having is that when i try to go to the website im getting

Forbidden

You don't have permission to access / on this server.
Apache/2.4.9 (Win64) PHP/5.5.12 Server at 24.225.31.76 Port 80

I've gone over all my steps a few times, obviously i've missed something. can anyone help me out with what I have missed or need to do still? thanks

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: Otomatic (Moderator)
Date: May 19, 2015 07:00PM

Hi,

Please answer to READ BEFORE YOU ASK A QUESTION

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: joshd (---.dvmercy.com)
Date: May 19, 2015 07:23PM

1 - Windows version used --windows 7 pro 64 bit
2 - Version WampServer --2.5 64bit
3 - Apache Version--2.4.9
4 - PHP Version--5.5.1
5 - MySQL Version--5.6.17
6 - What color is the WampServer icon--Green
When all goes well it should be green, but it may be red or orange.





If you find any errors that you cannot fix for yourself please post the COMPLETE EXACT error message in your question.
I get this when i open a browser page and try to go to the website:

Forbidden

You don't have permission to access / on this server.
Apache/2.4.9 (Win64) PHP/5.5.12 Server at 24.225.31.76 Port 80




7 - In the file c:\Windows\System32\drivers\etc\hosts, what are the active lines with the name [localhost] in them?
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost


127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 dvmercy

:: localhost
:: dvmercy


If the WampServer icon is green:

8 - Do you have access to localhost--yes
9 - Do you have access to phpMyAdmin--yes

10 - If you refer to an error message, please include the EXACT wording of the error in your post
I get this when i open a browser page and try to go to the website:

Forbidden

You don't have permission to access / on this server.
Apache/2.4.9 (Win64) PHP/5.5.12 Server at 24.225.31.76 Port 80

11 - If you use an Antivirus and / or Firewall, please include the names of these--microsoft security essentials, no firewall
12 - What is the full path to the installation of WampServer--C:\wamp

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: Otomatic (Moderator)
Date: May 19, 2015 08:46PM

Hi,

Hosts file: Only
127.0.0.1 localhost
127.0.0.1 dvmercy
::1 localhost
::1 dvmercy
or
127.0.0.1 localhost dvmercy
::1 localhost dvmercy
Nothing else.

>When all goes well it should be green, but it may be red or orange.
It is - still - need to know what you do for the icon is not green.

> I get this when i open a browser page and try to go to the website:
What do you do to access your local website?
What do you type (or that you see) in the browser's address bar?

What is the content of the file wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf?

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: joshd (---.dvmercy.com)
Date: May 19, 2015 09:12PM

First thank you for your help i really appreciate it!

>When all goes well it should be green, but it may be red or orange.
It is - still - need to know what you do for the icon is not green.---the icon is green


What do you do to access your local website?

in the browser i type: localhost/dvmercy
if i only type: localhost then it shows me the wampserver configuration page
if i type: localhost/dvmercy/wp-admin it shows me the dashboard for dvmercy wordpress
What do you type (or that you see) in the browser's address bar?

What is the content of the file wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf?

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:[httpd.apache.org];
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>


<VirtualHost *:80>
DocumentRoot "c:/wamp/www/dvmercy"
ServerName localhost
<Directory "c:/wamp/www/dvmercy">
AllowOverride All
Require local
</Directory>
</VirtualHost>

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: joshd (---.dvmercy.com)
Date: May 19, 2015 09:16PM

Also i changed the hosts file to

127.0.0.1 localhost dvmercy
::1 localhost dvmercy

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: Otomatic (Moderator)
Date: May 19, 2015 09:59PM

Hi,
I'll write detailled answer tomorrow morning.
With Smartphone it is not very easy.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: joshd (---.dvmercy.com)
Date: May 19, 2015 10:13PM

thank you for the update and your help. nobody should be forced to handle any of this on a smart phone...

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: Otomatic (Moderator)
Date: May 20, 2015 10:07AM

Hi,

- Your local domain name is dvmercy, so, ServerName should be dvmercy, not localhost.
- You dont need ServerAlias for localhost
So, httpd-vhosts.conf file should be:
#
# Virtual Hosts
#

<VirtualHost *:80>
   ServerName localhost
   DocumentRoot c:/wamp/www
  <Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Require local
  </Directory>
</VirtualHost>

<VirtualHost *:80>
   ServerName dvmercy
   ServerAlias www.dvmercy
   DocumentRoot c:/wamp/www/dvmercy
  <Directory "c:/wamp/www/dvmercy/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Require local
  </Directory>
</VirtualHost>
You launch your site by (httpd://dvmercy/) (Without parentheses**)

In your case, as your local site is a subdirectory of c:/wamp/www/ and as c:/wamp/www/ is localhost, you can launch by (httpd://localhost/dvmercy/) but it is a very bad solution because, in this case, $_SERVER['DOCUMENT_ROOT'] is c:/wamp/www/ then it should be c:/wamp/www/dvmercy/
This is this wrong way to do that is at the source of many problems with web applications like Joomla or Wordpress or others.

(**) I write the url with parentheses, otherwise the php parser of the forum turns them into clickable url.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: joshd (---.dvmercy.com)
Date: May 20, 2015 03:35PM

ok i fixed the httpd-vhosts.conf file to what you said it should be above. I still get the 403 forbidden when i go to our public IP. 24.225.31.76
All I'm wanting to do is host a site that is made using wordpress on my pc. Is there a better way of doing this and still be able to host it on my pc? I wanted to use wordpress so that its easy for the person working on the site to do updates etc.

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: Otomatic (Moderator)
Date: May 20, 2015 03:47PM

Hi,

> I still get the 403 forbidden when i go to our public IP. 24.225.31.76
It is impossible to go to a local site with the public IP from the local PC. Il you want to test access from internet, you must use another PC and, for this, you must authorize public access to the local site.
<VirtualHost *:80>
   ServerName dvmercy
   ServerAlias www.dvmercy
   DocumentRoot c:/wamp/www/dvmercy
  <Directory "c:/wamp/www/dvmercy/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Require all granted
  </Directory>
</VirtualHost>

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: joshd (---.dvmercy.com)
Date: May 20, 2015 04:38PM

ok so my httpd-vhosts.conf file is now:

<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp/www
<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName dvmercy
ServerAlias www.dvmercy
DocumentRoot c:/wamp/www/dvmercy
<Directory "c:/wamp/www/dvmercy/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>


is there something more i need to change to grant public access? I tried it from another pc and still get the forbidden page.

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: Otomatic (Moderator)
Date: May 20, 2015 05:00PM

Hi,

You are right : (http://24.225.31.76/dvmercy/) gives me You don't have permission to access /dvmercy/ on this server.
After you have modified http-vhosts.conf, have you restart Apache ?
- Wampmanager icon->Apache->Service->Restart service.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: joshd (---.dvmercy.com)
Date: May 20, 2015 05:02PM

yes i did restart all services using the wamp menu and to be safe i rebooted the pc but still get the same thing?

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: Otomatic (Moderator)
Date: May 20, 2015 05:39PM

Hi,

The Wampserver access from the Internet are not much of my ability, since I've never done testing.
Nevertheless, it should have to be declared in the hosts file (in addition to local matches), the correspondence between the IP seen by your modem and your site, for example

192.168.1.33 dvmercy

It should also parameterize your modem to perform a translation of the ports, for example:

Name Protocole Type Extern Port Destination IP Destination Port

HTTPD TCP Port 80 192.168.1.33 80

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: joshd (---.dvmercy.com)
Date: May 20, 2015 06:03PM

Hi, i understand what your saying and I do have the correct ports open in the router/firewall. In fact in the beginning I could go to [24.225.31.76] and it would show the wamp server configuration page. I was trying to get it to show dvmercy webpage when entering [24.225.31.76] instead of the wamp server config page.

Would it be easier if I would reset things so that it would again show the wamp server config page if I typed [24.225.31.76] in the browser address bar?

And maybe then try changing what is needed changed so that it would show the dvmercy webpage?

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: RiggsFolly (---.as43234.net)
Date: May 23, 2015 01:39PM

Hi Josh,

If you want to access a virtual host by name, then you have to address the site correctly from the remote client. So using just the IP address is not good enough.

What is actually happening with your current config is that a remote client using your WAN ip address is getting to your router, then is being forwarded to the PC running wampserver (Apache) but Apache does not know what to do with just the ip address!
So Apache is going through its default procesing which says :-

Can I find a Virtual host's [ServerName or ServerAlias] that matches the [24.225.31.76]? No... So route this access attempt to the first virtual host definition in the httpd-vhost.conf file.... which is of course the definition of 'localhost'
But 'localhost' is only allowed to be accessed from the PC running Apache because it is set to [Require local]

My prefered solution to this is to either :-

1. Buy a real domain name and set that up to point to your routers WAN ip address.
This is fine if you have a) the money and b) a static ip address that does not change when you reboot your router.

or
2. Get a Dynamic DNS domain name from someone like 'DYNDNS.COM' (costs) or 'NOIP.COM'

This allows you to create a domain name, although it is a slightly strange format like 'dvmercy.dyndns.org' for example. You then get a little bit of software that runs on the PC that has WAMPServer(Apache) installed on it that updated the dynamic ip address associated with your ip address should it ever chnage after a reboot.

You can then tell your users to use 'dvmercy.dyndns.org' (only an axample) to get to your site. You then change your VHOST definition to match the domain name you picked from whichever Dymanic DNS provider you used.

<VirtualHost *:80>
   ServerName dvmercy.dyndns.org
   ServerAlias dvmercy.dyndns.org
   DocumentRoot c:/wamp/www/dvmercy
   <Directory "c:/wamp/www/dvmercy/">
      Options Indexes FollowSymLinks MultiViews
      AllowOverride all
      Require all granted
   </Directory>
</VirtualHost>

Now when a user connects to your domain name apache can match the domain name to an existing VirtualHost definitions ServerName.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 1 time(s). Last edit at 05/23/2015 01:39PM by RiggsFolly.

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: joshd (---.dvmercy.com)
Date: May 27, 2015 04:59PM

Ok and I do have a domain purchased, right now we have it forwarding to our current website on another server while we give our site a make over. The site gets very little traffic and has been hosted free for us but we are losing this benefit soon. We are a non-profit so we are trying to just host the website in house now. We have a static public IP as you said we would need. I was simply trying to test my settings using the public IP address so that once the site is done i could be sure wamp server was working. I realized i had to change the DNS record but for some reason didnt make the connection in my brain that just using the public ip wouldnt push it to my test site.

our website is dvmercy.com and will be used with public IP 24.225.31.76 Can you tell me what exactly I need to have in the httpd-vhost.conf file so that it will work correctly once i change the DNS?

Thank you for all your help!!

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: RiggsFolly (---.as43234.net)
Date: May 27, 2015 07:00PM

OK,

Yes I can see that the site needs a re-vamp, definitely get rid of the annoying sounds it makes and the naff menu system.

So I am now assuming you do not want to allow access to your new/development version of your site to the universe.

However when it is ready you want to switch the DNS to point to the ipaddress of the machine you are developing on and have everything just jump into life when you do.

I must start with a warning WAMPServer is not configured to be a LIVE web server, it is intended to be a development environment That does not mean that it cannot be used for a live site, just that there are quite a few things that should be done to it to make it properly secure.
These things are too numerous for this forum and quite possibly beyond my knowledge.

Some obvious limitations are :-
Windows Desktop operating system are not designed/configured to run live web servers.
For example W7/8 can have only 20 external connection at any one time, previous versions allow even less.
If you have a Windows Server then this limitation can be configured up, but they cost more in the first place.

Securing a windows desktop OS for use with a Web Server requires some very specific knowledge and experience, which I would guess you do not have.

Securing Apache for extenal use is also something that has not been done by default in a WAMPServer install.


To be honest, as a simple hosting package can be purchased for $40 per year I would suggest you do that. This way you get the required knowledge and experience for next to nothing.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: 403 forbidden when try to go to website
Posted by: joshd (---.dvmercy.com)
Date: May 27, 2015 07:29PM

Can you recommend a good host to use with wordpress that is affordable? 40$ is pretty cheap for a year and not having to worry about security issues on a desktop OS.

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


Sorry, only registered users may post in this forum.