I have apache web server with several virtualhosts
I would like all of them be behind basic authorization (AuthType Basic)
But – it seems the Auth derective works only for <Location> and <Directory> (inside Virtualhost section)
is there a way to set basic auth globally for all virtual hosts at once ?
Any
<Directory>or<Location>set in global configuration (httpd.conf or apache2.conf on Debian) will apply for all VirtualHosts, as a global configuration is shared by definition.It’s quite hard to share a
<Directory>location, as you may have differentDocumentRootfor your VirtualHosts. But<Location />is a good target, all your Virtualhosts will have a ‘/’ url.So, if you put that in a
<Location />in the global definition it will work, unless a<Location />on one VirtualHost is using some directive to remove the Auth.