The old chestnut - you don't have permision to access /
Posted by: fainleog (109.255.16.---)
Date: October 28, 2019 06:23PM

I am a reasonably experienced IT person but am new to WAMP.
I have a brand-new PC running Win 10 Pro 64-bit at latest 1903 level. No other software installed.

My objective is to run the new machine as a web server. I have a fixed public IP address and have a domain name not yet pointed at my IP. On the new machine I want to use WordPress to build a site. I have forwarded incoming Port 80 to my new machine’s internal IP address. I have turned off Windows Firewall. I have a second PC on the same LAN as the web server.

I want the resulting webserver site to be always live on the internet – even as I build and test it locally on the server. That’s what I want!!

I have installed WAMP 3.1.9 64-bit and ensured all the C++ thingies are installed. I have used the default location C:/wamp and have installed WordPress 5.2.4 as recommended in c:/wamp/www/wordpress/

Wampserver starts fine with the green symbol. If I go to localhost I see the WampServer Config page as expected. If I go to localhost/wordpress I see the WP sample page.

So far, so good. I now go to another PC on the same LAN and enter the local IP address of the server PC. I get the well-known and very well reported message “you don’t have permission to access / on this server’. I read as many hits as I can on this forum but am not any wiser.
Clearly WAMP is setup by default to only work locally. Good. I understand that. But I want to change it.
I also attempted access from the internet using my fixed public IP address and get the same message (just as I expected)

Now to the problem. I did not set up a Virtual Host. This seems to be the answer to many of the instances of this error message. So, I ask – what is a Virtual Host? Nowhere can I find a simple explanation of this concept. I can see in the various config files, statements which appear to limit things to local access (DENY ALLOW etc etc) but I am reluctant to start changing any of these without understanding what it’s all about. I did try reading the official docs but lost the will!!

I would appreciate please a short explanation or a pointer to where I can find a longer one!!
Or even better, what to change to get access from other than local.

I did try adding a “virtual host” - see below for resulting conf file.
But it’s the open access that I really want to achieve. Just that.

I do well appreciate that this is not a problem with WAMP but rather my limited understanding!

Thank you.


# Virtual Hosts

#

<VirtualHost *:80>

ServerName localhost

ServerAlias localhost

DocumentRoot "${INSTALL_DIR}/www"

<Directory "${INSTALL_DIR}/www/">

Options +Indexes +Includes +FollowSymLinks +MultiViews

AllowOverride All

Require local

</Directory>

</VirtualHost>




#

<VirtualHost *:80>

ServerName testwp

DocumentRoot "c:/wamp/www/wordpress"

<Directory "c:/wamp/www/wordpress/">

Options +Indexes +Includes +FollowSymLinks +MultiViews

AllowOverride All

Require local

</Directory>

</VirtualHost>

Options: ReplyQuote
Re: The old chestnut - you don't have permision to access /
Posted by: Otomatic (Moderator)
Date: October 28, 2019 07:39PM

Hi,

In a way, a VirtualHost is a box, virtual of course, but a box that will contain information like :
- Site name (ServerName)
- Where is the site (DocumentRoot) and on which storage device?
- Site folder (<Directory) parameters such as access permissions, possible url rewriting, and others.
This simply allows the 'http' protocol to display the page in a browser.

Apache Documentation : [httpd.apache.org]

All hosting providers use VirtualHost, but you didn't know it and you don't see it because VirtualHost already exists when you install a site there.

And this is the key to the problem of the proper installation of a CMS or a web application and WordPress in particular.
But.... VirtualHost must exist BEFORE installing WordPress on it.

To avoid risky manipulations, I advise you to delete your current Wordpress, create a VirtualHost and, with Wampserver, it can be done in three clicks, then only then, install Wordpress in this VirtualHost.

And, for your information, there is absolutely no requirement that the VirtualHost folder be wamp64/www/wordpress/ it can be c:/mysites/wordpress/. The only relationship between the name of your site (ServerName) and the folder in which it is located is precisely the VirtualHost definition.

See
The need for Virtual Host and Wampserver 3 - Create or add a VirtualHost

> I am a reasonably experienced IT person but am new to WAMP.
A quick wink: Not so new, you already posted 22 messages here ten years ago, five years ago and three years ago.

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



Edited 1 time(s). Last edit at 10/28/2019 07:44PM by Otomatic.

Options: ReplyQuote
Re: The old chestnut - you don't have permision to access /
Posted by: fainleog (109.255.16.---)
Date: October 28, 2019 07:44PM

Thank you Otomatic,

Can I assume that if I do as you suggest, it will solve the problem of only being able to get localhost access?
i.e. it will open the server to the wider internet?

F.

Options: ReplyQuote
Re: The old chestnut - you don't have permision to access /
Posted by: Otomatic (Moderator)
Date: October 28, 2019 08:22PM

Hi,

> it will open the server to the wider internet?
No, not the server! Only the VirtualHost(s) you want.
It would be a very bad idea to open the entire server to wrongdoers. This is how the old versions of Wamp worked by putting the entire server offline or online. VirtualHost has been included with Wampserver 3.0.0.0 and, with the latest versions, this Online option no longer exists.

This does not mean that your VirtualHost will be accessible from the outside simply; it depends on many factors including Windows settings as well as the firewall and other more or less obscure "tricks".
To be honest, there have been a few users - not many - for whom external access has never worked.

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

Options: ReplyQuote
Re: The old chestnut - you don't have permision to access /
Posted by: fainleog (109.255.16.---)
Date: October 28, 2019 08:27PM

HHHmmmmm not very reassuring smiling smiley
Let me go off and try what you suggest.
Thanks again
F.

Options: ReplyQuote
Re: The old chestnut - you don't have permision to access /
Posted by: fainleog (109.255.16.---)
Date: October 29, 2019 08:05PM

I am sorry if I am not being clear with my intentions. To simplify:
I have deleted WORDPRESS. Leave it aside.
I have uninstalled WAMP
I have restarted the PC and reinstalled WAMP
In c:/wamp64/www I have added a new folder called test.
Into c:/wamp64/www/test I have added a simple hello world test.php program
I have gone thru the procedure to add a virtual host for my new test project.
The new virtual hosts file is below.
I can access localhost and localhost/test without a problem
The wamp icon is green. I restarted services several times.
THEN I go to another PC on the LAN and try to connect to my WAMP server's local IP - 192.168.0.33
I also try to access 192.168.0.33/test
In both cases I get the dreaded message - you don't have permission etc etc.
I also get the dreaded message when I access the server over the internet via my public IP address.
So I conclude there is no problem with firewalls or port forwarding.
It's just that WAMP defaults to local access only.
PLEASE - how do I fix it so I can access my test project via the LAN and the internet?
Thank you for taking the trouble to read this!!
F.


# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>


#
<VirtualHost *:80>
ServerName vhtest
DocumentRoot "c:/wamp64/www/test"
<Directory "c:/wamp64/www/test/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

Options: ReplyQuote
Re: The old chestnut - you don't have permision to access /
Posted by: RiggsFolly (Moderator)
Date: October 29, 2019 11:40PM

Well quite simply you now need to tell Apache that it is allowed to accept connections from ip addresses other then the one that it is running on. So change the VH for your Wordpress site to allow access from any ip on your internal subnet..



<VirtualHost *:80>
ServerName vhtest
DocumentRoot "c:/wamp64/www/test"
    <Directory "c:/wamp64/www/test/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
        Require ip 192.168.0
    </Directory>
</VirtualHost>

Note: this is not a WAMPServer thing this is pure Apache, so a look at the Apache documentation (link in my signature) would be a good idea.

---------------------------------------------------------------------------------------------
(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: The old chestnut - you don't have permision to access /
Posted by: fainleog (109.255.16.---)
Date: October 30, 2019 12:38AM

Thank you for that suggestion.
I updated the VH file as you suggest but it made no difference. Same error message.
I tried both the specific subnet address and the generic 192.168.0
I edit the VH file, save it and restart the services.
BUT THEN
I added the REQUIRE ip statement to both VRs as below, and now it works.
I can access the server from any PC on the subnet.
Does that make sense?

AND FINALLY - how do I open access to the internet?
I want to use my public IP address to access the test site.
I have port 80 forwarded to the server IP address.


F.

# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
Require ip 192.168.0
</Directory>
</VirtualHost>


#
<VirtualHost *:80>
ServerName vhtest
DocumentRoot "c:/wamp64/www/test"
<Directory "c:/wamp64/www/test/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
Require ip 192.168.0
</Directory>
</VirtualHost>



Edited 1 time(s). Last edit at 10/30/2019 12:41AM by fainleog.

Options: ReplyQuote
Re: The old chestnut - you don't have permision to access /
Posted by: RiggsFolly (Moderator)
Date: October 30, 2019 03:47PM

Again a look at the The Apache Documentation would have brought you to this

Require all granted

NOTE: This has its dangers. If you dont know what you are doing this could well open your system up to the delights of the hacker community
YOU DO THIS AT YOUR OWN RISK



Regarding having to change the access for `localhost` as well. This suggests that you are using the URL `localhost/test` and not the URL `vhtest` from the Virtual Host definition.

You should NEVER EVER open localhost up using `Require all granted`


To be able to access the server using 'vhtest` amend the hosts file `c:\windows\system32\drivers\etc\hosts` on the PC's that are being used to access the WAMPServer (Apache) PC and add an entry telling these other PC where to go to find `vhtest`

So assuming the WAMPServer is running on 192.168.0.100 do this on the other PC's

192.168.0.100 vhtest

Now after a refresh of the DNS Cache on the Client PC(s) Heres a How To (or a reboot) you should be able to access the WAMPServer (Apache) using the url `vhtest` and not `localhost/test`

---------------------------------------------------------------------------------------------
(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: The old chestnut - you don't have permision to access /
Posted by: fainleog (109.255.16.---)
Date: October 30, 2019 07:47PM

Thank you for those comments. I appreciate the risk of opening the site to the internet.
But isn't that the objective? I want people to access the site from the internet.
I must be missing something?

I am familiar with your RTFM recommendations!! I couldn't agree more!!
But I find the WAMP documentation to be like a forest of trees.
If you know which tree you want, all of the infornation about the tree is there.
But if you want an aerial view of the forest, I find it to be a challenge.

I do appreciate your time.

F.

Options: ReplyQuote
Re: The old chestnut - you don't have permision to access /
Posted by: RiggsFolly (Moderator)
Date: October 30, 2019 08:15PM

Yup

As we like to say, WAMPServer is easy to install, but knowledge of how to use it does not come out of the box as easily.

Also we support WAMPServer, however APACHE AND MYSQL AND PHP come with their own Manuals which we do not write.

---------------------------------------------------------------------------------------------
(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


Sorry, only registered users may post in this forum.