Hello list,
I need to search for all virtual domains in an apache config file. Example:
<VirtualHost 192.168.1.5>
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /home/blah.com/www
ServerName www.blah.com
ErrorLog /home/blah.com/logs/error_log
CustomLog /home/blah.com/logs/access_log common
</VirtualHost>
<VirtualHost 192.168.1.6>
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /home/test.blah.com/www
ServerName test.blah.com
ErrorLog /home/test.blah.com/logs/error_log
CustomLog /home/test.blah.com/logs/access_log common
</VirtualHost>
I need to get whatever the ServerName is. Here's what I have:
open(APACHE_CONF, "/usr/local/apache/conf/httpd.conf") or die "Could not
open Apache config file:\n$!\n";
my @servernames;
while(<APACHE_CONF>) {
push (@servernames, $1)
if/ServerName\swww..(.*)/;
}
close(APACHE_CONF);
my $h;
foreach $h(@servernames) {
# blah blah blah
}
That only gets the ServerName if it starts with a "www". How could I get it
no matter what ServerName starts with?
Thanks,
Tyler
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]