I have a set of sites co-hosted in one of our development servers.
I need to configure to ALL of those sites the
Allow from
directive. Since this is about dynamic IPs, that change relatively frequently, I need to setup a way in order to easily modify them.
Example:
<VirtualHost *:443>
ServerName dbhost.domain
ServerAdmin webmaster@domain
DocumentRoot /srv/www/dbhost
DirectoryIndex index.php index.php3 index.php4
SSLEngine On
<Directory /srv/www/dbhost>
order deny,allow
allow from 192.168.0.0/16 <subnet1> <subnet2> <subnet3> <etc...>
deny from all
AllowOverride None
AuthType Digest
AuthDigestAlgorithm MD5
AuthName "devs"
AuthDigestDomain /
AuthDigestDomain /
AuthDigestProvider file
AuthUserFile <pwdfile>
Require valid-user
<Directory>
So, I want to include that "order/allow" in an external file, so I will be able to to easily use it to all configuration files and change it just once.
So, I created a new file that had the following lines:
order deny,allow
allow from 192.168.0.0/16 <subnet1> <subnet2> <subnet3> <etc...>
deny from all
And then, I modified the directive as:
<Directory /srv/www/dbhost>
Include /fullpath/to/acl.conf
AllowOverride None
However, apachectl -t reported errors:
apache2ctl -t
Syntax error on line 1 of /fullpath/to/acl.conf:
order not allowed here
So, is there any other way to do that?
This approach is OK. It will work like that. The problem is probably because your Apache is interpreting this file (acl.conf) as is (not only as included file), because it has .conf extension - you probably have
Include *.conf
somewhere inhttpd.conf
orapache.conf
.Change the name of the file to e.g. acl.include and should be OK.