I don't use the sites-enabled/sites-available possibility, but include a list of vhost entries from one configuration file - so I was wondering if the following is possible?
An older installation I have on Apache 2.2 allows me to set one default vhost entry as the first entry - configure the dir settings - and have all the others follow suit - or so it appeared. I didn't have to set the directory settings for each vhost separately. (I'll add additional info if this is not clear)
However, since 2.4 it seems that I have to set the directory setting for each vhost entry? If I don't I get a 403 forbidden message right off the bat. Once I add the directory entry (granted for all) - all is fine.
Is there a possibility to set the directory settings (granted for all) as a default setting?
Answer
There are multiple contexts available for most Apache configuration directives.
The two you are concerned about are Server Config (aka Global) and Virtual Host. Most directives that can be applied to a specific virtual host can also be applied globally, outside of a
tag.
If a directive is used in the Server Config context, then it will apply to all virtual hosts unless a conflicting directive is specifically applied.
In the official documentation for the directives of Apache and its modules, you will see the following keywords to describe which context they can be used in:
Snippet from Apache:
server config - This means that the directive may be used in the server configuration files (e.g., httpd.conf), but not within any
or
containers. It is not allowed in .htaccess files at all.
virtual host - This context means that the directive may appear inside
containers in the server configuration files.
directory - A directive marked as being valid in this context may be used inside
,
,
,
, and
containers in the server configuration files, subject to the restrictions outlined in Configuration Sections.
.htaccess - If a directive is valid in this context, it means that it can appear inside per-directory .htaccess files. It may not be processed, though depending upon the overrides currently active.
Source: Apache 2.4 Documentation
No comments:
Post a Comment