I'm looking for a way to organize the files that makes up the apache sites-enabled configuration.
Let's say I have sites A, B and C on my webserver. These sites have different DocumentRoot s and different RewriteRule s as well as different Authentication requirements. Defined by Alias and Directory contexts. I'm on a debian based server.
I want both a http and https version of A, B and C.
ServerName www1.myhome.com;, I want to serve A and B.
ServerName www2.myhome.com;, I want to serve B and C.
How do I avoid duplication of the configuration of A, B and C?
I was trying to use includes in different forms. Including configuration for e.g. A into the different virtualhosts, but I found the problem with file paths cumbersome. In particular it doesn't allow me to
a2ensite A. Also it makes troubleshooting the configuration file a nuisance. This is all done as a part of migrating from Apache2.2 to Apache2.4.
Is there a good solution to this problem?
Configuration site A. B and C are similar in structure.
Alias /A /srv/rootA/ <Directory /srv/rootA/> // Unique stuff for A // In particular Auth and rewrite rules </Directory>