For example, the document root of virtualHost
is /var/www
, and server name is aaa.com
.
However, apache will tell me forbidden
if I access the server with localhost
and aaa.com
. If I change the Directory
option in http.conf
to /var/www
, apache will work well. I don't know why?
I want to set Directory
option in every httpd-vhosts.conf
, not in httpd.conf
, how I can do it?
Here is my http.conf
:
Here is my httpd-vhosts.conf
:
This configuration was valid for apache version 2.2
First check your apache version by typing
apachectl -V
in your terminal.If it shows something like this
then your apache version has updated but the conf you are using is deprecated.
So instead of
2.2 configuration:
use this:
2.4 configuration:
For further documentation related to the upgrade, follow the official docs:
http://httpd.apache.org/docs/current/upgrading.html
2.4 configuration:
In
http.conf
file you should define options for only<Directory />
. All the options of VirtualHosts you should define inhttpd-vhosts.conf
files. Something like:httpd.conf:
httpd-vhosts.conf: