diff options
Diffstat (limited to 'bin/ldap2apache')
-rwxr-xr-x | bin/ldap2apache | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/bin/ldap2apache b/bin/ldap2apache index e976fae..5f961b5 100755 --- a/bin/ldap2apache +++ b/bin/ldap2apache @@ -26,6 +26,7 @@ clients = ldap.conn.search2(@config['basedn'], LDAP::LDAP_SCOPE_SUBTREE, 'object @www_gid = @config['module']['apache']['www_gid'] @configtest = @config['module']['apache']['configtest'] @reload = @config['module']['apache']['reload'] +@statsbind = @config['module']['apache']['statsbind'] files = {} @@ -186,6 +187,19 @@ clients.each{ |c| config << " </Directory>" end config << " #{addto}" if addto + # + # webstats, part I - proxy to our second webserver + unless property['stats'] == "no" + config << ' Alias /awstats-classes/ "/usr/share/awstats/classes/"' + config << ' Alias /awstats-css/ "/usr/share/awstats/css/"' + config << ' Alias /awstats-icon/ "/usr/share/awstats/icon/"' + config << " <IfModule mod_proxy.c>" + config << " ProxyPass /webstats/ http://#{@statsbind}/" + config << " ProxyPassReverse /webstats/ http://#{@statsbind}/" + config << " ProxyPreserveHost on" + config << " </IfModule>" + + end config << "</VirtualHost>" config << '# vim:ft=apache:' throw "Clash on #{server_name} of client#{c['o'][0]}" if files[ c['o'][0] +"-"+ server_name ] @@ -212,18 +226,11 @@ clients.each{ |c| files[ c['o'][0] +"-"+ sn2 ] = config end # - # webstats - #config << " # Alias " + @webstat_location + " " + @rmagicdir + "/" + server_name + "/" - #config << ' Alias /awstats-classes/ "/usr/share/awstats/classes/"' - #config << ' Alias /awstats-css/ "/usr/share/awstats/css/"' - #config << ' Alias /awstats-icon/ "/usr/share/awstats/icon/"' - #config << " ScriptAlias /cgi-stats/awstats.pl /usr/lib/cgi-bin/awstats.pl" - #config << " Redirect permanent " + @webstat_location + " http://"+server_name+"/cgi-stats/awstats.pl" - + # webstats, part II - we need our own vhost since we can't have suexec enabled unless property['stats'] == "no" config = [] - config << "<VirtualHost #{bind}:#{bindhttpport}>" - config << " ServerName stats.#{server_name}" + config << "<VirtualHost #{@statsbind}>" + config << " ServerName #{server_name}" config << " ServerAdmin #{server_admin}" config << " UserDir disabled" config << " ErrorLog #{client_home}/logs/stats.#{server_name}-error.log" @@ -234,9 +241,8 @@ clients.each{ |c| config << ' Alias /awstats-classes/ "/usr/share/awstats/classes/"' config << ' Alias /awstats-css/ "/usr/share/awstats/css/"' config << ' Alias /awstats-icon/ "/usr/share/awstats/icon/"' - config << " ScriptAlias /cgi-stats/awstats.pl /usr/lib/cgi-bin/awstats.pl" - config << " RewriteEngine on" - config << " RewriteRule ^/$ /cgi-stats/awstats.pl [L,R]" + config << " ScriptAlias /awstats.pl /usr/lib/cgi-bin/awstats.pl" + config << " ScriptAlias / /usr/lib/cgi-bin/awstats.pl" config << "</VirtualHost>" config << '# vim:ft=apache:' |