From 1e8f80626d75e9d767600fba000af1da8a185953 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 18 Oct 2006 16:59:51 +0000 Subject: Do away with stats. vhosts git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@225 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- bin/ldap2apache | 32 +++++++++++++++++++------------- bin/ldap2awstats | 4 ++-- bin/ldap2bind | 10 ---------- 3 files changed, 21 insertions(+), 25 deletions(-) (limited to 'bin') 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 << " " 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 << " " + config << " ProxyPass /webstats/ http://#{@statsbind}/" + config << " ProxyPassReverse /webstats/ http://#{@statsbind}/" + config << " ProxyPreserveHost on" + config << " " + + end config << "" 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 << "" - config << " ServerName stats.#{server_name}" + config << "" + 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 << "" config << '# vim:ft=apache:' diff --git a/bin/ldap2awstats b/bin/ldap2awstats index 8ddab10..7f1d378 100755 --- a/bin/ldap2awstats +++ b/bin/ldap2awstats @@ -53,9 +53,9 @@ clients.each{ |c| config << 'Include "/etc/awstats/awstats.conf"' config << 'LogFile="zcat '+client_home+'/logs-archive/'+server_name+'-access*gz |"' config << 'SiteDomain="'+server_name+'"' - config << 'HostAliases="'+server_aliases+' '+server_name+' stats.'+server_name+'"' + config << 'HostAliases="'+server_aliases+' '+server_name+'"' - files[ 'awstats.stats.'+server_name+'.conf' ] = config.join("\n") + "\n" + files[ 'awstats.'+server_name+'.conf' ] = config.join("\n") + "\n" } } diff --git a/bin/ldap2bind b/bin/ldap2bind index c245e60..139a4b0 100755 --- a/bin/ldap2bind +++ b/bin/ldap2bind @@ -180,16 +180,6 @@ magicItems.each { |m| setAs(vhostalias, m['tnHost'], m['dn'][0]) } end - property = {} - if m['tnWebVHostProperties'] - m['tnWebVHostProperties'].each{ |prop| - (key, val) = prop.split('=', 2) - property[key] = val - } - end - unless property['stats'] == "no" - setAs(m['tnWebVHostServerName'].map { |v| "stats."+v } , m['tnHost'], m['dn'][0]) - end when 'tnDNSrr' if m['tnDNSaRecord'] setAsDirect(m['tnDNSdomainname'], m['tnDNSaRecord'], m['dn'][0]) -- cgit v1.2.3