Page 1 of 1

Implement Apache v2.4 Access Control in apache2.conf / httpd.conf NOT .htaccess

Posted: Sat Jul 21, 2018 7:52 am
by Bestia
On our site https://subdomain.example.com we want to only allow access via certain IP.

We edited :

/home/admin/conf/web/subdomain.example.com.apache2.ssl.conf

adding the following into the directory container for the site :
/home/admin/web/subdomain.example.com/public_html/

<RequireAll>
Require ip xxx.xxx.xxx.xxx
</RequireAll>

This approach and variations on it does not work.
...

By itself in the .htaccess, Require ip directive does work.

I ran :
apache2ctl -V | grep SERVER_CONFIG_FILE
and of course it returns /etc/apache2/apache2.conf

So, I suspect I will need to add a virtual host to the apache2.conf, but then why not do this in the domain specific VirtualHost confs?

apache2.conf also includes the conf.d dir and its config files - including vesta conf which loads the domain specific confs.

Can someone shed light on how to achieve domain specific access control in Apache 2.4 ?

Any clarifications and help would be appreciated.

...

I have read the docs here :
https://httpd.apache.org/docs/2.4/mod/m ... _host.html
https://httpd.apache.org/docs/2.4/howto/access.html