Forbidden: You don't have permission to access / - apache

I've looked as so many examples here, but I still can't access my WAMP server from my other computer. I have no problem from the computer where WAMP is installed.
I notice that it says You don't have permission to access / - why / ?
// httpd.conf
<Directory "D:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from ::1
Allow from 192.168.0.1 // <- typo
Allow from 192.168.1.148
</Directory>
//httpd.vhosts.conf
<VirtualHost 192.168.1.119>
DocumentRoot D:/wamp/www/mysite/
ServerName mysite.com
ServerAlias mysite.com
</VirtualHost>
// Host file
192.168.1.119 localhost
192.168.1.119 mysite.com

Try these changes
First this controls access to your WAMPServer homepage, add all the possible local address to the allow list.
You seem to have 2 subnets in your list, is that a typo? I am assuming so.
Also if you use just the first 3 quartiles of the ip address it will allow from any ip on that subnet.
// httpd.conf
<Directory "D:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from ::1 127.0.0.1 localhost
Allow from 192.168.1
</Directory>
You dont mention any port number on your VHOST definition and there is no need to use a specific ip address.
Also it is a good idea to add a localhost VHOST, and to put the access restrictions i.e. the <Directory...> block inside each individual VHOST definition. Then you can modify the access privilages on each VHOST specifically.
Also the syntax for the access rights chnaged in Apache 2.4.x so I have coded the access rights section using the parameter that was added in WAMPServer2.5 releases, but it should work as it is even of you are still on an older WAMPServer version i.e. 2.4 or 2.2
// extras/httpd-vhost.conf
# Should be the first VHOST definition so that it is the default virtual host
# Also access rights should remain restricted to the local PC and the local network
# So that any random ip address attack will recieve an error code and not gain access
<VirtualHost *:80>
DocumentRoot "D:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "D:/wamp/www">
AllowOverride All
<IfDefine APACHE24>
Require local
Require ip 192.168.1
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.0/8 localhost ::1 192.168.1
</IfDefine>
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/wamp/www/mysite"
ServerName mysite.com
ServerAlias www.mysite.com
<Directory "D:/wamp/www">
AllowOverride All
<IfDefine APACHE24>
Require local
Require ip 192.168.1
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.0/8 localhost ::1 192.168.1
</IfDefine>
</Directory>
</VirtualHost>

Related

Cant access WAMP over LAN

I have read many posts here and many tutorials as well.. and for some reason.. I just cant get access to my WAMP install/pages/content from other machines on the network?
WAMP 2.4 (still) :)
Here is what I have tried so far:
WAMP install machine IP: 192.168.1.121
I have enabled/disbaled Windows Firewall on the WAMP install machine (completely for testing)
I have created a an INBOUND rule allowing (TCP, on PORT 80, private option selected only, also tried to check public)
Apache httpd.config:
Listen 192.168.1.121:80
Listen 80
Then a bit below:
Order Deny,Allow
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
Allow from 192.168.1.101
Allow from all
Complete:
<Directory "c:/wamp/www">
Options Indexes FollowSymLinks
AllowOverride All
# onlineoffline tag - don't remove
Order Deny,Allow
# Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
Allow from 192.168.1.101
Allow from all
</Directory>
I my Apache httpd-vhosts.conf file I have (outside of some other default and test entries) the following:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
<Directory "c:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#BarBot.com
DocumentRoot "c:/wamp/www/barbot/"
ServerName BarBot
ErrorLog "logs/BarBot-error.log"
CustomLog "logs/BarBot-access.log" common
<directory "c:/wamp/www/barbot/">
Options +Indexes +FollowSymLinks +MultiViews
Require all granted
#Deny from all
#AllowOverride All
#Allow from 127.0.0.1
#Require all granted
#Require ip 192.168.1
#Require ip 192.168.1:80
</directory>
</VirtualHost>
I grabbed a netbook I had laying around.. plugged it into my network..
loaded up browser and went to:
192.168.1.121
as well as
192.168.1.121:80
192.168.1.121:80/barbot
I will either get:
timed out message on browser..
or more recently
Not found: The requested URL /barbot was not found..etc..etc..
At this point I am lost.. I dont even have a direction to pursue or test with?
I have also tried to toggle putting WAMP online/offline.. neither state seemed to make a difference?
What am I missing here? What things can I test out? And is there a way to check on things? Logs? Errors? Something that will give me direction? Or help get direction at least?)
Update:
Second PC -
IP: 192.168.1.101
I can PING the 192.168.1.121 machine just fine.. never misses a packet.
Final State:
Something is 'working', but must be configured somehow/somewhere?
When I attempt to open: 192.168.1.121:80/barbot (WAMP machine) I get a NOT FOUND (404) page...
If I try to go to say... 192.168.1.121:8080 (I get Unable to Connect page/message)..

WampServer: 403 Forbidden

All of a sudden my local WampServer vhosts are not working.
I've added a new vhost to vhosts.conf and hosts.
When I load that vhost in a web browser, I receive 403 Forbidden.
In vhosts.conf, I have:
<VirtualHost *:80>
ServerName example.com.au
ServerAlias example.com.au
DocumentRoot "D:\Dropbox\WAMP\WWW\example.com.au"
<Directory "D:\Dropbox\WAMP\WWW\example.com.au">
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
</VirtualHost>
In httpd.conf I have:
Listen 10.0.0.199:80 ::1
Listen [::0]:80
<Directory />
AllowOverride none
Require all denied
</Directory>
where 10.0.0.199 is my PC's IP.
WampServer is online.
WampServer 3.0.6
Apache 2.4.23
Help appreciated.
I changed
<Directory />
AllowOverride none
Require all denied
</Directory>
to
<Directory />
AllowOverride none
Require all granted
</Directory>
in httpd.conf, and that resolved the 403 error.
The default config in httpd.conf has all the Listen parameters you need
Listen 0.0.0.0:80
Listen [::0]:80
This says listen on port 80 of whatever this PC's ip address is for both IPV4 and IPV6 address ranges, and is all you need.
This section of httpd.conf should also be left as you found it. This sets up the basic denial of all rights to all folders on the drive where you installed WAMPServer(Apache) and should do exactly that. Change it back to this
<Directory />
AllowOverride none
Require all denied
</Directory>
This is for your security. It say nobody is allowed access to the root of this driver and therefore no access to anything below the root. Once this is set you are then supposed to open up access to ONLY what Apache actually need access to. That is what you do in your httpd-vhosts.conf file for only the folders that site requires access too.
If you are hacked, then a hacker can only access those folder given access and NOT YOUR WHOLE DRIVE.
Your Virtual Host definition in httpd-vhosts.conf shoudl look like this
<VirtualHost *:80>
ServerName example.com.au
ServerAlias www.example.com.au
DocumentRoot D:/Dropbox/WAMP/WWW/example.com.au
<Directory "D:/Dropbox/WAMP/WWW/example.com.au/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
## Dangerous unless you really mean to
## allow the universe into your server
## I would use one of the other options and comment this one out
Require all granted
# If access from this PC only then us
# i.e. you are a standalone developer
# uncomment this
#Require local
#If access from your local network is required
# i.e. you are working with other devs within your local network
# uncomment this
#Require ip 10.0.0
</Directory>
</VirtualHost>
Note the use of Unix forward slashes and the <Directory.... tag needs a trailing slash
Then check your HOSTS file it should be like this
127.0.0.1 localhost
::1 localhost
127.0.0.1 example.com.au
::1 example.com.au

wamp server put online for anyone to access

Hi ive been attempting to set up a wamp server so people can access it for testing
everything works correctly on my pc and i believe i have everything set up correctly but noone can connect to the site as it cant be reached
i have opened port 80 on my router and my firewall
my hosts file is as follows
127.0.0.1 localhost
::1 localhost
127.0.0.1 bandicam.com
127.0.0.1 ssl.bandisoft.com
127.0.0.1 btcGame.local
::1 btcGame.local
my httpd-vhosts.conf is as follows
#
# Virtual Hosts
#
<VirtualHost *:80>
DocumentRoot "g:/wamp/www"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
<Directory "G:/wamp/www">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName btcGame.local
ServerAlias www.btcGame.local
DocumentRoot "c:/wamp64/www/btcgame"
ErrorLog "logs/btcGame-error.log"
CustomLog "logs/btcGame-access.log" common
<Directory "/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
is there any other things i need to change in order to get my website online?
Other people trying to access your computer should know where to look.
Your server should then be referenced in the hosts file of their machine, except that IP should be resolvable such as
your.local.ip btcGame.local

Wamp is Green and Online but still 403 error

C:\wamp\bin\apache\apache2.4.9:
<VirtualHost *:80>
DocumentRoot C:\wamp\wwww\sk\public
ServerName sk.localhost
SetEnv APPLICATION_ENV "development"
<Directory "C:\wamp\wwww\sk\public">
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
Require local
Allow from localhost ::1 127.0.0.1
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:\wamp\wwww\sk\public
ServerName sk.localhost
SetEnv APPLICATION_ENV "development"
<Directory "C:\wamp\wwww\sk\public">
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
Require local
Allow from localhost ::1 127.0.0.1
</Directory>
</VirtualHost>
Hosts file:
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
127.0.0.1 sk.localhost
When I try to access localhost or sk.localhost it gives me 403 error (Wamp is green and Online. Anyone can help please? I don`t know what am I doing wrong here. I tried several methods from Internet but with no luck. Any help would be much appreciated. Best regards, Bogdan.
PHPMyadmin is working.
This is probably because you are using 2 different versions of the access security syntax and Apache is getting confused.
Change your Virtual Host definitions as below to use just the Apache 2.4 syntax and not the Apache 2.2 ones.
Also you should create a VH for localhost as well, as when you implement Virtual Hosts, Apache ignores the definition of localhost in the httpd.conf file.
# Should be the first VHOST definition so that it is the default virtual host
# Also access rights should remain restricted to the local PC
# So that any random ip address attack will recieve an error code and not gain access
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:\wamp\wwww\sk\public
ServerName sk.localhost
SetEnv APPLICATION_ENV "development"
<Directory "C:\wamp\wwww\sk\public">
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:\wamp\wwww\sk\public
ServerName sk.localhost
SetEnv APPLICATION_ENV "development"
<Directory "C:\wamp\wwww\sk\public">
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Require local
</Directory>
</VirtualHost>
The Require local tells Apache to only allow access to a VH domain if the client is on the PC running WampServer(Apache).
If you actually want to allow access from say another PC on your local network, you can add a line like this to the domain you want to access
Require local
Require ip 192.168.1
Or if you want to allow access from anwhere replace those lines with
Require all granted
WARNING Dont allow access to the universe unless you really know what you are doing.
PS The WAMPserver Online/Offline feature only controls access and does not mean APache is running or not. Also once you implement Virtual Hosts it no longer has any relevance and shoudl be set OFFLINE as access control is now held in each individual Virtual Host.

You don't have permission to access / on this server WAMP server on Windows 7 after setting up vhost

I get this error : You don't have permission to access / on this server.
vhost plugin enabled in apache webserver and inside the vhost i have this:
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/myfiles"
ServerName domain.com
ServerAlias domain.com
ErrorLog "logs/domain.com.log"
CustomLog "logs/domain.com" common
</VirtualHost>
works on my laptop not on my tmp-server running windows7
First when you setup vhosts it is best to also create one for localhost.
Also you need to tell apache from which ip addresses it is allowed to accept connections from for each of the vhosts.
So try this
# Should be the first VHOST definition so that it is the default virtual host
# Also access rights should remain restricted to the local PC and the local network
# So that any random ip address attack will recieve an error code and not gain access
<VirtualHost *:80>
ServerAdmin webmaster#homemail.net
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "c:/wamp/www">
AllowOverride All
<IfDefine APACHE24>
Require local
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.0 localhost ::1
</IfDefine>
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/myfiles"
ServerName domain.com
ServerAlias domain.com
ErrorLog "logs/domain.com.log"
CustomLog "logs/domain.com" common
<Directory "C:/wamp/www/myfiles">
AllowOverride All
Options Indexes FollowSymLinks
<IfDefine APACHE24>
Require local
Require ip 192.168.2
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.0 localhost ::1
</IfDefine>
</VirtualHost>
Finally if you mean you enabled vhost_alias_module in Apache, you do not need that in order to use Virtual Hosts like this, so you should disable it.
To activate the extra\vhost-httpd.conf changes, dont forget to uncomment this line in the httpd.conf file, so that this extra file gets included.
Include conf/extra/httpd-vhosts.conf