I have to define about 100 subdomain virtualhost entries in server config file . I want to know if there is any way to do it with regular expression to increase codes in apache config file?
I have to define about 100 subdomain virtualhost entries in server config file . I want to know if there is any way to do it with regular expression to increase codes in apache config file?
You should have a look at this how to from the Apache documentation, I think that's what you need here:
http://httpd.apache.org/docs/2.2/vhosts/mass.html
update:
Using Mass Virtual Hosting forbids the use of different log files:
However this is not really a problem because you can use the %v filter for CustomLog which places the ServerName in front of each logged request, you can then filter and split logs if necessary based on this.
A good practice is to put those logs in a mysql database (on the fly or through a cronjob, pipe or a fifo file) because SQL is a great tool to extract meaningful informations from them.
Have a look on this article which describes settign up (direct) database logging through mod_log_mysql:
http://onlamp.com/pub/a/apache/2005/02/10/database_logs.html
Storing your logs directly in a database mysql can be a good solution through the ARCHIVE storage engine but it has its own limitations (lock table on write). An alternative would be building you system on a more standard storage engine (innodb, xtradb for example), if you already have a mysql server I'd try that before other solutions as it doesn't require much learning.
If you feel a little more adventurous you can have a look at MongoDB, as a document oriented database it is particularly fit as a log storage system (fast, powerful filter capabilities, speed of insertion/read) but be sure to have a good dedicated server for it as you'll need RAM for it to behave adequately.
You'll find details on MongoDB logging here:
http://www.slideshare.net/WombatNation/logging-app-behavior-to-mongo-db
http://www.mongodb.org/display/DOCS/Admin+Zone
No, but what are you trying to do? Having a regex in the
<VirtualHost>
line would make no sense.ServerAlias
can have wildcards, not regex; this might give you what you need?