Error apache : access denied - apache

My configuration :
Wampserver 3.0.0 32bits
Apache 2.4.17
php 5.6.15
mysql 5.7.9
My problem :
WampServer start properly, but when I try to access a project in the log i have:
[Sat May 21 10:55:39.393866 2016] [authz_core:error] [pid 6984:tid 1140] [client 127.0.0.1:50070] AH01630: client denied by server configuration: C:/wamp/www/project/api/app/
[Sat May 21 10:55:39.395878 2016] [authz_core:error] [pid 6984:tid 1140] [client 127.0.0.1:50070] AH01630: client denied by server configuration: C:/wamp/www/project/api/src/
Yet I check my configuration files and all seems OK.
There are my configs files :
httpd.conf :
<Directory "C:/wamp/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# [httpd.apache.org]
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
#onlineoffline tag - don't remove
#Require local
Require all granted
</Directory>
httpd-vhosts.conf:
<VirtualHost *:80>
ServerAdmin admin#test.fr
ServerName localhost
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#test.fr
ServerName localhost.project.com
#ServerAlias localhost.project.com
DocumentRoot "C:/wamp/www/project/website/web/"
<Directory "C:/wamp/www/project/website/web/">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#test.fr
DocumentRoot "C:/wamp/www/project/api"
ServerName api.project.com
#ServerAlias api.project.com
<Directory "C:/wamp/www/project/api">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#test.fr
DocumentRoot "C:/wamp/www/Demo_websocket/web"
ServerName demo.websocket
#ServerAlias demo.websocket
<Directory "C:/wamp/www/Demo_websocket/web">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>
My hosts file :
I think I do not understand very well what you mean. The content of my
hosts file is :
127.0.0.1 localhost
127.0.0.1 api.project.com
127.0.0.1 localhost.project.com
I already tried to set Require all granted in VirtualHost but no success :s
If someone has already faced this problem and found a solution , I'm interested. Thank you

you are using localhost with virtual hosting,
if this is your hosts file, it is correct
127.0.0.1 localhost
127.0.0.1 api.project.com
127.0.0.1 localhost.project.com
and in your local browser you'll write one of these urls.
But your virtual host configuration must respond to a specific host and not to *, for example fo api you must have <VirtualHost api.project.com:80> and not <VirtualHost *:80>
also the generic * virtual host MUST be at the end of the list, then the result is:
<VirtualHost localhost.project.com:80>
ServerAdmin admin#test.fr
ServerName localhost.project.com
#ServerAlias localhost.project.com
DocumentRoot "C:/wamp/www/project/website/web/"
<Directory "C:/wamp/www/project/website/web/">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost api.project.com:80>
ServerAdmin admin#test.fr
DocumentRoot "C:/wamp/www/project/api"
ServerName api.project.com
#ServerAlias api.project.com
<Directory "C:/wamp/www/project/api">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost demo.websocket:80>
ServerAdmin admin#test.fr
DocumentRoot "C:/wamp/www/Demo_websocket/web"
ServerName demo.websocket
#ServerAlias demo.websocket
<Directory "C:/wamp/www/Demo_websocket/web">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#test.fr
ServerName localhost
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www">
Options +Indexes +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>

Related

Why isn't my apache httpd server serving content from my VirtualHost

I have an apache httpd server running on a linux server. The server's fqdn is www.example.com, but I have a dns alias of www.example2.com for the same server.
When I access the server using my browser and use http://www.example.com it serves the correct content, but if I use http://www.example2.com, I get the default content from my /var/www/html folder not the content from the /var/www/html2 folder.
A stripped-down copy of my httpd.conf file follows:
ServerName www.example.com:80
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
CustomLog "logs/access_log" combined
ErrorLog "logs/error_log"
LogLevel warn
<VirtualHost www.example2.com:80>
ServerName www.example2.com:80
DocumentRoot /var/www/html2
CustomLog "logs/access_log2" combined
ErrorLog "logs/error_log2"
<Directory "/var/www/html2">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.example2.com
DocumentRoot /var/www/html2
CustomLog "logs/access_log2" combined
ErrorLog "logs/error_log2"
<Directory "/var/www/html2">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
The VirtualHost tag is for IP based filtering, to filter by host\server name use the ServerName directive.

Apache2 how to working www.example.com

I need help. I am sorry wrong write. My LAMP server i created virtual host working http://example.com a NOT WORKING http://www.exaple.com
<VirtualHost *:80>
DocumentRoot "/var/www/example/1/public_html"
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster#localhost
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
UseCanonicalName on
<Directory "/usr/lib/cgi-bin">
AllowOverride all
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
<Directory "/var/www/example/1/public_html">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
Considering that you have put a local mapping to example.com in /etc/hosts. Do you have same entry for www.example.com also?
example of the /etc/hosts entry:
127.0.0.1 example.com www.example.com
or
xxx.xxx.xxx.xxx example.com www.example.com
(xxx.xxx.xxx.xxx being your hosting server IP)

Vhosts not working

I have the following vhosts setup:
<VirtualHost *:80>
ServerAdmin admin#localhost.com
DocumentRoot "C:\Apache24\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost cake-photos.com:80>
ServerAdmin admin#localhost.com
DocumentRoot "C:\Apache24\htdocs\cake-photos"
ServerName cake-photos.com
ServerAlias *.cake-photos.com
<Directory "C:\Apache24\htdocs\cake-photos">
Options Indexes FollowSymLinks
AllowOverride all
Require ip 127.0.0.1
</Directory>
</VirtualHost>
<VirtualHost fangwear.co.uk:80>
ServerAdmin admin#localhost.com
DocumentRoot "C:\Apache24\htdocs\Fangwear 2014"
ServerName fangwear.co.uk
ServerAlias www.fangwear.co.uk
<Directory "C:\Apache24\htdocs\Fangwear 2014">
Options Indexes FollowSymLinks
AllowOverride all
# Require all granted
Require ip 127.0.0.1
</Directory>
</VirtualHost>
<VirtualHost manager.com:80>
ServerAdmin admin#localhost.com
DocumentRoot "C:\Apache24\htdocs\Manager 2014"
ServerName manager.com
ServerAlias www.manager.com
<Directory "C:\Apache24\htdocs\Manager 2014">
Options Indexes FollowSymLinks
AllowOverride all
# Require all granted
Require ip 127.0.0.1
</Directory>
</VirtualHost>
None of it seems to be working and if I try to go to any of these I end up being redirected to the cake-photos.com vhost.
I need to be able to get to other things too such as localhost/phpmyadmin but that won't work with this configuration.
Where am I going wrong?
Did you set up your hosts file? On Unix Systems /etc/hosts? And did you restart your server?

XAMPP Windows Apache vhosts not redirecting properly

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/"
ServerName localhost
<Directory "C:/xampp/htdocs/">
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/gl"
ServerName gl.dev
<Directory "C:/xampp/htdocs/gl">
Order allow,deny
allow from all
</Directory>
</VirtualHost>
The above is what I currently have in my vhosts file. When I hit localhost I want my root to open, but when I load gl.dev I want the individual site to open. Any ideas?
hosts file:
127.0.0.1 localhost
# ::1 localhost
127.0.0.1 gl.dev
I think in windows you have to use backslash when specifying document root. please try the following
<VirtualHost *:80>
ServerName localhost
ServerAlias *.localhost
DocumentRoot "C:\xampp\htdocs\"
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName gl.dev
ServerAlias *.gl.dev
DocumentRoot "C:\xampp\htdocs\gl"
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Restart WAMP server

Apache Multi-sites

I've created two virtual hosts. tester.ly and tucnak.me
/sites-available/Lab:
<VirtualHost tucnak.me:80>
ServerAdmin kovalevskiy11#gmail.com
ServerName tucnak.me
DocumentRoot /home/tucnak/Web/Lab/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/tucnak/Web/Lab/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
#... here smth skipped.
</VirtualHost>
And /sites-available/Tester:
<VirtualHost tester.ly:80>
ServerAdmin kovalevskiy11#gmail.com
ServerName tester.ly
DocumentRoot /home/tucnak/Web/Tester/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/tucnak/Web/Tester/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
# skipped too.
</VirtualHost>
And my apache2 output:
[Mon Feb 13 20:17:07 2012] [warn] VirtualHost tucnak.me:80 overlaps with VirtualHost tester.ly:80, the first has precedence, perhaps you need a NameVirtualHost directive
I think that smthing wrong directive cause this problem. So, I need help.
You may have a NameVirtualHost *:80 or NameVirtualHost * directive in your configuration.
This mean your starting VirtualHost directives should be:
<VirtualHost *:80>
(...)
<VirtualHost *:80>
(...)
And not :
<VirtualHost tester.ly:80>
(...)
<VirtualHost tucnak.me:80>
(...)
The name of the VirtualHost is given by the ServerName directive inside the VirtualHost, not by the name used in the <VirtualHost xxx>. And this xxx should match one of the NameVirtualHost declarations in main configuration.