in reply to Updating config files with dynamic ip

If you have mod_perl compiled, you can use <Perl> sections to dynamically configure your apache configuration. This is what jcwren uses to automatically configure a virtual host for each of his users. He simply adds to /etc/perlmonk_users, and the next time apache starts up, the virtual host is automatically configured:
<Perl> my $server = "perlmonk.org"; my @users = do { local @ARGV = "/etc/perlmonk_users"; <> }; chomp @u +sers; foreach my $user (@users) { push @{ $VirtualHost{"*"} } , { ServerName => "$user.$server", ServerAdmin => "$user\@$server", DocumentRoot => "/home/$user/public_html", ScriptAlias => [ "/cgi-bin/", "/home/$user/public_html/cgi-bin/" + ], CustomLog => [ "/home/$user/www_logs/access_log", "common" ], ErrorLog => "/home/$user/www_logs/error_log" }; } </Perl>
Anyway, it's just an example of what can be done. Space is the limit... (most likely; the physicists haven't worked that one out yet)

ar0n ]

  • Comment on (ar0n: &lt;Perl&gt; sections) Re: Updating config files with dynamic ip
  • Download Code