1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

awstats install guide for beginners

Discussion in 'Plesk for Linux - 8.x and Older' started by ivsdigitel, May 12, 2005.

  1. ivsdigitel

    ivsdigitel Guest

    0
     
    Here is a full guide for linux in a few very simple steps :

    first you will need a shell access, the most popular program is putty (ssh emulator) download one if you dont have it, login as a root user and folow the instructions:

    1) you need to install awstats, the best way to install it is using awstats rpm, so run this command first.

    # wget http://easynews.dl.sourceforge.net/sourceforge/awstats/awstats-6.4-1.noarch.rpm

    if you want to use other version of rpm find url first and replace this one.

    2) to install run this command

    # rpm -ivh awstats-6.4-1.noarch.rpm

    3) then you will need to setup awstats_configure.pl run:

    # cd /usr/local/awstats/tools
    and
    # ./awstats_configure.pl
    you will be asked about your domain and path to httpd.conf file so enter
    /etc/httpd/conf/httpd.conf

    4) you need to provide correct path to access_log file, so open conf file for your domain using vi text editor usin this command:

    # vi /etc/awstats/awstats.www.yourdomain.com.conf
    change log path to:
    LogFile="/home/httpd/vhosts/yourdomain.com/statistics/logs/access_log"
    and close editor with "ZZ" command.

    5) All you need to do now is to update awstats data base using one of these two commands
    for each domain
    # /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.yourdomain.com
    or if you want to update all at the same time us this
    # /usr/local/awstats/tools/awstats_updateall.pl now
    it would be nice if you add these commands to cron tab
    now use this url to see if everything is ok
    http://localhost/awstats/awstats.pl?config=www.yourdomain.com

    Notice: if you want to add another domain just repeat these steps from 3-5
    www.soloymi.com
     
  2. ElricM

    ElricM Guest

    0
     
    Beautiful.

    Thanks
     
  3. ProfiTiger

    ProfiTiger Guest

    0
     
    Hi ivsdigitel,
    tried your (very easy, thanks!!!) installation-guide. Everything worked fine but opening awstats.pl in browser. Here I get an 500 Internal Server error. On SSH, everithings works fine, static statisticfile is generated as html and no probs.
    When looking to the errorlog of this domain, I get much entries "Premature end of script headers: awstats.pl"
    I looked around on the web and found much topics on this problem. But all the hints (transfer awstats.pl in ascii-mode, chmod 755 and so on) did not work for me. So I tried other sites and found one on my box where awstats where working. Shocking. I looked for the difference between the hostings and found out, that I have to DISABLE CGI in the setup of a hosting, restart apache and then awstats are working on this domain.
    Do you have any idea about this problem??? I can't tell my clients not to use cgi... They will hang me ;)
    Greetings,
    ProfiTiger
     
  4. jrister

    jrister Guest

    0
     
    Thanks for posting this. I was experiencing the same issue myself after following the instructions above, and disabling the CGI for the domain in question worked for mine as well after the 500 errors.

    If I had to guess as to the reason for this, I suspect it may be related to the fact that the script is running at more of a root level, rather than per-domain. When you disable the CGI for domain, it looks higher in the server for the desired script.

    Thats just a guess though, dont take it for gospel.
     
  5. ivsdigitel

    ivsdigitel Guest

    0
     
    I don't know what to say
    i don't have these king of problems evrything works fine
     
  6. ProfiTiger

    ProfiTiger Guest

    0
     
    I told my provider about this problem. He is still searching for a fix, the reason is found, i will try to translate it from german to english:
    ***************************************************************
    [...]The problem is caused by the suexec-wrapper, which prevents cgi/perlscripts from running out of the document-root:
    -----------
    myServer:/home/httpd/vhosts/domain.de # tail /var/log/apache2/suexec.log
    [2005-06-13 09:03:30]: uid: (10001/amb-swing) gid: (10001/10001) cmd: awstats.pl
    [2005-06-13 09:03:30]: command not in docroot (/usr/local/awstats/wwwroot/cgi-bin/awstats.pl)
    ----------
    ***************************************************************
    So it could be a hint to cp awstats.pl to the cgi-bin-directory into the vhosts docroot, but I think there will be problems with finding the config-files and who want's to copy all the data each time a new domain is created?
    My provider will do some tests on a testbox and perhaps find a solution. Otherwise, I will tell him to open a ticket at plesk, perhaps they can help, or is this a problem of the distribution (SuSE 9.2)???
     
  7. ProfiTiger

    ProfiTiger Guest

    0
     
  8. ProfiTiger

    ProfiTiger Guest

    0
     
    My provider got a workaround from plesk-support:
    ********************************************************************
    > the problem was in paths -- awstats directory is located outside
    > vhosts directory and suexec has too strict restrictions so even
    > aliases doesn't help. I've made following:
    >
    > cd /home/httpd/vhosts/domain.name/httpdocs
    > ln -s /usr/local/awstats/wwwroot/classes/ awstatsclasses
    > ln -s /usr/local/awstats/wwwroot/css/ awstatscss
    > ln -s /usr/local/awstats/wwwroot/icon/ awstatsicons
    > ln -s /usr/local/awstats/wwwroot/cgi-bin awstats
    >
    > then I've commented out following strings in vhost.conf for domain.name:
    >
    > Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
    > Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
    > Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
    >
    > and changed paths in ScriptAlias and <Directory>:
    >
    > -ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"
    > +ScriptAlias /awstats/ "/home/httpd/vhosts/domain.name/httpdocs/awstats/"
    > -<Directory "/usr/local/awstats/wwwroot">
    > +<Directory "/home/httpd/vhosts/domain.name/httpdocs/awstats/">
    >
    > And now awstats working fine.
    ********************************************************************

    So the vhost.conf of a domain running awstats looks like this

    # Directives to allow use of AWStats as a CGI
    ScriptAlias /awstats/ "/home/httpd/vhosts/domain.dame/httpdocs/awstats/"
    #
    # This is to permit URL access to scripts/files in AWStats directory.
    #
    <Directory "/home/httpd/vhosts/ddomain.name/httpdocs/awstats/">
    Options none
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>

    Any one any ideas how to make this automaticly (p.e. on domain-creation) ???
     
  9. ProfiTiger

    ProfiTiger Guest

    0
     
    Done...
    i wrote(modified another...) a little script which does all of this for me. The script is started by the eventmanager in the CP on domaincreation. And it works!!! The only problem: vhosts.conf (if exists) is overwritten. But on new domain, this should be no problem. This script creates a pwd-protected dir "logs" on the vhost and creates an index.hrml with redirect to the awstatspl with parameters so the user can easy call www.domain.com/logs to view his logs ;) The conf-file for astats is created too.
    Explanation of parameters: $1 = <new_domain_name>
    I saved this script as "new_domain.sh" in "/usr/local/psa/bin" with rights: 774 root root
    ****************************************
    #!/bin/bash
    cd /home/httpd/vhosts/$1/httpdocs
    ln -s /usr/local/awstats/wwwroot/classes/ awstatsclasses
    ln -s /usr/local/awstats/wwwroot/css/ awstatscss
    ln -s /usr/local/awstats/wwwroot/icon/ awstatsicons
    ln -s /usr/local/awstats/wwwroot/cgi-bin awstats
    mkdir logs
    cp /home/httpd/vhosts/$1/conf/vhost.conf /home/httpd/vhosts/$1/conf/vhost.conf.bak

    cat > /home/httpd/vhosts/$1/conf/vhost.conf <<EOF

    # Directives to allow use of AWStats as a CGI
    ScriptAlias /awstats/ "/home/httpd/vhosts/$1/httpdocs/awstats/"
    #
    # This is to permit URL access to scripts/files in AWStats directory.
    #
    <Directory "/home/httpd/vhosts/$1/httpdocs/awstats/">
    Options none
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>

    <Directory "/home/httpd/vhosts/$1/httpdocs/logs">
    AuthType Basic
    AuthName "AWSTATS"
    AuthUserFile /home/httpd/vhosts/$1/pd/d..plesk-stat
    require valid-user
    </Directory>
    EOF

    cat > /etc/awstats/awstats.www.$1.conf <<EOF
    LogFile="/home/httpd/vhosts/$1/statistics/logs/access_log"
    LogType=W
    LogFormat=1
    LogSeparator=" "
    SiteDomain="www.$1"
    HostAliases="$1 www.$1 127.0.0.1 localhost"
    DNSLookup=2
    DirData="/var/lib/awstats"
    DirCgi="/cgi-bin"
    DirIcons="/awstatsicons"
    AllowToUpdateStatsFromBrowser=0
    AllowFullYearView=2
    EnableLockForUpdate=0
    DNSStaticCacheFile="dnscache.txt"
    DNSLastUpdateCacheFile="dnscachelastupdate.txt"
    SkipDNSLookupFor=""
    AllowAccessFromWebToAuthenticatedUsersOnly=0
    AllowAccessFromWebToFollowingAuthenticatedUsers=""
    AllowAccessFromWebToFollowingIPAddresses=""
    CreateDirDataIfNotExists=0
    BuildHistoryFormat=text
    BuildReportFormat=html
    SaveDatabaseFilesWithPermissionsForEveryone=0
    PurgeLogFile=0
    ArchiveLogRecords=0
    KeepBackupOfHistoricFiles=0
    DefaultFile="index.html"
    SkipHosts=""
    SkipUserAgents=""
    SkipFiles=""
    OnlyHosts=""
    OnlyUserAgents=""
    OnlyFiles=""
    NotPageList="css js class gif jpg jpeg png bmp ico swf"
    ValidHTTPCodes="200 304"
    ValidSMTPCodes="1 250"
    AuthenticatedUsersNotCaseSensitive=0
    URLNotCaseSensitive=0
    URLWithAnchor=0
    URLQuerySeparators="?;"
    URLWithQuery=0
    URLWithQueryWithOnlyFollowingParameters=""
    URLWithQueryWithoutFollowingParameters=""
    URLReferrerWithQuery=0
    WarningMessages=1
    ErrorMessages=""
    DebugMessages=0
    NbOfLinesForCorruptedLog=50
    WrapperScript=""
    DecodeUA=0
    MiscTrackerUrl="/js/awstats_misc_tracker.js"
    LevelForBrowsersDetection=2
    LevelForOSDetection=2
    LevelForRefererAnalyze=2
    LevelForRobotsDetection=2
    LevelForSearchEnginesDetection=2
    LevelForKeywordsDetection=2
    LevelForFileTypesDetection=2
    LevelForWormsDetection=0
    UseFramesWhenCGI=1
    DetailedReportsOnNewWindows=1
    Expires=0
    MaxRowsInHTMLOutput=1000
    Lang="de"
    DirLang="./lang"
    ShowMenu=1
    ShowSummary=UVPHB
    ShowMonthStats=UVPHB
    ShowDaysOfMonthStats=VPHB
    ShowDaysOfWeekStats=PHB
    ShowHoursStats=PHB
    ShowDomainsStats=PHB
    ShowHostsStats=PHBL
    ShowAuthenticatedUsers=0
    ShowRobotsStats=HBL
    ShowWormsStats=0
    ShowEMailSenders=0
    ShowEMailReceivers=0
    ShowSessionsStats=1
    ShowPagesStats=PBEX
    ShowFileTypesStats=HB
    ShowFileSizesStats=0
    ShowOSStats=1
    ShowBrowsersStats=1
    ShowScreenSizeStats=0
    ShowOriginStats=PH
    ShowKeyphrasesStats=1
    ShowKeywordsStats=1
    ShowMiscStats=a
    ShowHTTPErrorsStats=1
    ShowSMTPErrorsStats=0
    ShowClusterStats=0
    AddDataArrayMonthStats=1
    AddDataArrayShowDaysOfMonthStats=1
    AddDataArrayShowDaysOfWeekStats=1
    AddDataArrayShowHoursStats=1
    IncludeInternalLinksInOriginSection=0
    MaxNbOfDomain = 10
    MinHitDomain = 1
    MaxNbOfHostsShown = 10
    MinHitHost = 1
    MaxNbOfLoginShown = 10
    MinHitLogin = 1
    MaxNbOfRobotShown = 10
    MinHitRobot = 1
    MaxNbOfPageShown = 10
    MinHitFile = 1
    MaxNbOfOsShown = 10
    MinHitOs = 1
    MaxNbOfBrowsersShown = 10
    MinHitBrowser = 1
    MaxNbOfScreenSizesShown = 5
    MinHitScreenSize = 1
    MaxNbOfWindowSizesShown = 5
    MinHitWindowSize = 1
    MaxNbOfRefererShown = 10
    MinHitRefer = 1
    MaxNbOfKeyphrasesShown = 10
    MinHitKeyphrase = 1
    MaxNbOfKeywordsShown = 10
    MinHitKeyword = 1
    MaxNbOfEMailsShown = 20
    MinHitEMail = 1
    FirstDayOfWeek=1
    ShowFlagLinks=""
    ShowLinksOnUrl=1
    UseHTTPSLinkForUrl=""
    MaxLengthOfShownURL=64
    HTMLHeadSection=""
    HTMLEndSection=""
    Logo="awstats_logo6.png"
    LogoLink="http://awstats.sourceforge.net"
    BarWidth = 260
    BarHeight = 90
    StyleSheet=""
    color_Background="FFFFFF" # Background color for main page (Default = "FFFFFF")
    color_TableBGTitle="CCCCDD" # Background color for table title (Default = "CCCCDD")
    color_TableTitle="000000" # Table title font color (Default = "000000")
    color_TableBG="CCCCDD" # Background color for table (Default = "CCCCDD")
    color_TableRowTitle="FFFFFF" # Table row title font color (Default = "FFFFFF")
    color_TableBGRowTitle="ECECEC" # Background color for row title (Default = "ECECEC")
    color_TableBorder="ECECEC" # Table border color (Default = "ECECEC")
    color_text="000000" # Color of text (Default = "000000")
    color_textpercent="606060" # Color of text for percent values (Default = "606060")
    color_titletext="000000" # Color of text title within colored Title Rows (Default = "000000")
    color_weekend="EAEAEA" # Color for week-end days (Default = "EAEAEA")
    color_link="0011BB" # Color of HTML links (Default = "0011BB")
    color_hover="605040" # Color of HTML on-mouseover links (Default = "605040")
    color_u="FFAA66" # Background color for number of unique visitors (Default = "FFAA66")
    color_v="F4F090" # Background color for number of visites (Default = "F4F090")
    color_p="4477DD" # Background color for number of pages (Default = "4477DD")
    color_h="66DDEE" # Background color for number of hits (Default = "66DDEE")
    color_k="2EA495" # Background color for number of bytes (Default = "2EA495")
    color_s="8888DD" # Background color for number of search (Default = "8888DD")
    color_e="CEC2E8" # Background color for number of entry pages (Default = "CEC2E8")
    color_x="C1B2E2" # Background color for number of exit pages (Default = "C1B2E2")
    ExtraTrackedRowsLimit=500
    EOF

    /usr/local/awstats/tools/awstats_updateall.pl now

    cat > /home/httpd/vhosts/$1/httpdocs/logs/index.html <<EOF
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="REFRESH" content="0; URL=http://www.$1/awstats/awstats.pl?$1">
    <title>Redirection...</title>
    </head>
    <body>
    <h1>Sie werden zu den Statistiken weitergeleitet...</h1>
    </body>
    </html>
    EOF

    /etc/init.d/apache2 restart
    ****************************************
    I think that with the installation-guide of ivsdigitel and this script, nearly everybody can run awstats on a plesk-box
    ;)

    If somebody has improvements or better ideas, I'm very interrested in as a newbie in plesk an bash....
     
  10. ivsdigitel

    ivsdigitel Guest

    0
     
    you should thank this guy, he really tryed to help you :D
     
  11. ProfiTiger

    ProfiTiger Guest

    0
     
    Which of the guys do you mean?

    I'm a bit new to plesk, but in the view months I'm working with, I learned: You have to help yourself to bring things to work. The best help you can get is this forum. So I have to thank all the members here :)
    And (in this case) there was help from my provider !and! plesk-support. The solution i got was not what I expected, but other threads in this forum told me about bash, automation and so on, so I was able to build my own solution ;)
     
  12. running3000

    running3000 Guest

    0
     
    still problems....

    hey guys, first of all... great work done...
    it helped me a lot. but unfortunately i get a 403 error when i try to access the awstats.pl

    it is stated in the error log of the domain, that symbolic links are not allowed.... how can i bypass this?

    thanks in advance
     
  13. ProfiTiger

    ProfiTiger Guest

    0
     
    Hi running3000,
    when does this error (symbolic links are not allowed) occur? When running awstats.pl? Or when running the script? Did you look, if the symlinks are there, or are you even not able to create them manually as root??? Please give us some more information...
     
  14. running3000

    running3000 Guest

    0
     
    ok, hi profitiger...

    symlinks are all there... there is everything where it should be...
    i solved it with '+Options FollowSymLinks' in .htaccess... :-(

    but not really sure if this is so secure, but i am the only person, who can create symlinks on the server...
     
  15. crazy4bass

    crazy4bass Guest

    0
     
    Thanks for the script. One quick question, how do you set it up in Event Manager so it knows how to pass the parameters?

    The script seems to work fine from ssh except awstats is now is some foriegn language for that domain and when going to http://domain.com/logs it's asking for a user/pass and I've no idea what that is...

    Any clues?

    Thanks
     
  16. ProfiTiger

    ProfiTiger Guest

    0
     
    hi crazy4bass, YES.

    in the event-manager, I added a new handler :

    /usr/local/psa/bin/addvhostperm.sh <new_domain_name> <new_system_user>

    on event "new physical hosting created" (<- my translation from german language, don't know how its written in english).

    <new_domain_name> and <new_system_user> ar filled up by plesk while creating the domain. A list of possible parameters for the event-manager can be found here:
    http://download1.sw-soft.com/Plesk/...ins-guide-html/ch02s27.html#handler.templates

    For other languages, change the line Lang="de" (german in my case) p.e. to Lang="en" for english language.

    The question for user/pass is wanted, without it, everybody could look into the logfiles. The script uses the user and password for the ftp-user (in domain-setup).
    If you wish to skip this, take the following lines out of the script (or for a single domain, delete them from vhosts.conf of the specified domain):
    ----------------------
    <Directory "/home/httpd/vhosts/$1/httpdocs/logs">
    AuthType Basic
    AuthName "AWSTATS"
    AuthUserFile /home/httpd/vhosts/$1/pd/d..plesk-stat
    require valid-user
    </Directory>
    ----------------------
    These lines do protect the logs-directory with password.

    Greetings,

    ProfiTiger
     
  17. msaunders

    msaunders Guest

    0
     
  18. dahamsta

    dahamsta Guest

    0
     
    Is there a reason you can't append rather than overwrite?

    Code:
    cat >> /home/httpd/vhosts/$1/conf/vhost.conf <<EOF
    BLAH
    EOF
    (Note >>.)adam
     
  19. ProfiTiger

    ProfiTiger Guest

    0
     
    Hi adam,
    thanks for that hint. A little ">" brings such as difference :)
    For not loosing other entries already made in vhost.conf, I make a copy of this file.
    Since I'm not a pro in scripting, I was happy to be able to make a script like I posted above.
    There is only one problem with appending the changes to vhost.conf: If I run the script twice, there are mutliple lines with the same code (it can happen that I have to do this, because after migrating a domain from another system, there is an other default ftp-account which is not similar to the ftp-account I create afterwards for this domain on the plesk-server). So I should know how to check, if there are already lines like "ScriptAlias /awstats/ "/home/httpd/vhosts/$1/httpdocs/awstats/""
    and make the additions only, if these lines do not exist. Or, if they exist, they should be deleted and added new. But my knowledge of scripting is to small to do this...
    Does anybody know if vhost.conf can include links to other .conf-files so I could create a knew one and link this in vhost.conf? This would be much easier to handle...
    I would be very happy for some further hints :rolleyes:
    ProfiTiger
     
  20. AlleyKat

    AlleyKat Guest

    0
     
    First of all, THANKS A LOT to ivsdigitel & ProfiTiger for starting this. It's absolutely fabulous.


    I have a few issues, but to avoid misunderstandings and maybe help other new users, let me first describe how I did:


    I'm using putty on my local windows to my FC3 Plesk 7.5.4 reloaded dedicated (fully yum updated to atomicrocketturtle). Quick tip for beginners: 'yum install joe mc lynx' is a good idea; joe (simple editor) is easier to use than VI (or vim IMHO), mc (Midnight Commander) is your good old Norton Commander for DOS on linux, and lynx is a textbased browser.


    First, followed ivsdigitels fine guide points 1 & 2 (using latest awstats rpm, 6.5-1 from SF, see exhibit A*), and 3 as far as possible; awstats config had a few more semi-hard questions which I think I managed ok. 4 was a breeze too - my FC3 uses /var/www/vhosts/ instead of home; 5 is basically what awstats tells you at the end of setup too and works.

    Testing AWstats kept giving an error about the DirData folder not being writeable or existing, and true enough - it's not there. I made a folder for data in the domain folder called /statistics/awstatslogs/ (766 apache: ) and fixed that in the config. No errors.

    So, I was at the same point as ProfiTiger and followed his directions to set it up on the website; creating the dyn.links and adding a vhosts-conf file (all I had was httpd.include & webalizer.conf) seemed to work fine. So far, so good (well excellent), I can set up manual awstats for individual domains as root.


    Now, I'd like to have it added to all domains on the server automatically at creation, so I followed the next step too - creating the new_domain.sh also went OK - mine looks like exhibit B*.

    I'm not sure why but adding an event as you described in the shell script post, (on domain creation) I ended up getting dynamic links and more created in the system / folder - I think I fixed this by changing ownership of the file from root: to psaadm: and do it on physical hosting creation event instead.



    1st issue: http://domain.tld/awstats/awstats.pl?config=www.domain.tld never seems to be protected. How do I make it so?

    2nd issue: I can't get into httpdocs/logs/ at all, it seems - althou I haven't tried turning off security in vhost.conf to get in.

    3rd issue: Tips! Tips on good default configurations for AWstats would be great.
    See THIS SITE for great tips!



    4rd issue (a bit offtopic?): Can I protect the files (symlinks) somehow?

    5th issue (way offtopic): could I squeeze in a directive for adding www aliases to subdomains in vhost.conf here too? Or would that be the wrong place?
    No, see HERE instead.




    Thanks so much for your fine guides; I wouldn't have gotten as far as this without it and hope some of this also might help new users ahead.


    * =

    Exhibit A:
    Code:
    # wget [url]http://heanet.dl.sourceforge.net/sourceforge/awstats/awstats-6.5-1.noarch.rpm[/url]
    # rpm -ivh awstats-6.5-1.noarch.rpm
    
    Exhibit B:
    (sorry long piece of code but in here for completion)
    (please note the different path and that awstats setup is Danish)
    Code:
    #!/bin/bash
    cd /var/www/vhosts/$1/httpdocs
    ln -s /usr/local/awstats/wwwroot/classes/ awstatsclasses
    ln -s /usr/local/awstats/wwwroot/css/ awstatscss
    ln -s /usr/local/awstats/wwwroot/icon/ awstatsicons
    ln -s /usr/local/awstats/wwwroot/cgi-bin awstats
    mkdir logs
    
    touch /var/www/vhosts/$1/conf/vhost.conf
    
    cd /var/www/vhosts/$1/statistics
    mkdir awstatslogs
    chmod 766 awstatslogs
    chown apache: awstatslogs
    
    cp /var/www/vhosts/$1/conf/vhost.conf /var/www/vhosts/$1/conf/vhost.conf.bak
    
    cat > /var/www/vhosts/$1/conf/vhost.conf <<EOF
    
    # Directives to allow use of AWStats as a CGI
    ScriptAlias /awstats/ "/var/www/vhosts/$1/httpdocs/awstats/"
    #
    # This is to permit URL access to scripts/files in AWStats directory.
    #
    <Directory "/var/www/vhosts/$1/httpdocs/awstats/">
    Options none
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
    
    <Directory "/var/www/vhosts/$1/httpdocs/logs">
    AuthType Basic
    AuthName "AWSTATS"
    AuthUserFile /var/www/vhosts/$1/pd/d..plesk-stat
    require valid-user
    </Directory>
    EOF
    
    cat > /etc/awstats/awstats.[url]www.[/url]$1.conf <<EOF
    LogFile="/var/www/vhosts/$1/statistics/logs/access_log"
    LogType=W
    LogFormat=1
    LogSeparator=" "
    SiteDomain="www.$1"
    HostAliases="$1 [url]www.[/url]$1 127.0.0.1 localhost"
    DNSLookup=2
    DirData="/var/www/vhosts/$1/statistics/awstatslogs/"
    DirCgi="/cgi-bin"
    DirIcons="/awstatsicons"
    AllowToUpdateStatsFromBrowser=0
    AllowFullYearView=2
    EnableLockForUpdate=0
    DNSStaticCacheFile="dnscache.txt"
    DNSLastUpdateCacheFile="dnscachelastupdate.txt"
    SkipDNSLookupFor=""
    AllowAccessFromWebToAuthenticatedUsersOnly=0
    AllowAccessFromWebToFollowingAuthenticatedUsers=""
    AllowAccessFromWebToFollowingIPAddresses=""
    CreateDirDataIfNotExists=0
    BuildHistoryFormat=text
    BuildReportFormat=html
    SaveDatabaseFilesWithPermissionsForEveryone=0
    PurgeLogFile=0
    ArchiveLogRecords=0
    KeepBackupOfHistoricFiles=0
    DefaultFile="index.html"
    SkipHosts=""
    SkipUserAgents=""
    SkipFiles=""
    OnlyHosts=""
    OnlyUserAgents=""
    OnlyFiles=""
    NotPageList="css js class gif jpg jpeg png bmp ico swf"
    ValidHTTPCodes="200 304"
    ValidSMTPCodes="1 250"
    AuthenticatedUsersNotCaseSensitive=0
    URLNotCaseSensitive=0
    URLWithAnchor=0
    URLQuerySeparators="?;"
    URLWithQuery=0
    URLWithQueryWithOnlyFollowingParameters=""
    URLWithQueryWithoutFollowingParameters=""
    URLReferrerWithQuery=0
    WarningMessages=1
    ErrorMessages=""
    DebugMessages=0
    NbOfLinesForCorruptedLog=50
    WrapperScript=""
    DecodeUA=0
    MiscTrackerUrl="/js/awstats_misc_tracker.js"
    LevelForBrowsersDetection=2
    LevelForOSDetection=2
    LevelForRefererAnalyze=2
    LevelForRobotsDetection=2
    LevelForSearchEnginesDetection=2
    LevelForKeywordsDetection=2
    LevelForFileTypesDetection=2
    LevelForWormsDetection=0
    UseFramesWhenCGI=1
    DetailedReportsOnNewWindows=1
    Expires=0
    MaxRowsInHTMLOutput=1000
    Lang="dk"
    DirLang="./lang"
    ShowMenu=1
    ShowSummary=UVPHB
    ShowMonthStats=UVPHB
    ShowDaysOfMonthStats=VPHB
    ShowDaysOfWeekStats=PHB
    ShowHoursStats=PHB
    ShowDomainsStats=PHB
    ShowHostsStats=PHBL
    ShowAuthenticatedUsers=0
    ShowRobotsStats=HBL
    ShowWormsStats=0
    ShowEMailSenders=0
    ShowEMailReceivers=0
    ShowSessionsStats=1
    ShowPagesStats=PBEX
    ShowFileTypesStats=HB
    ShowFileSizesStats=0
    ShowOSStats=1
    ShowBrowsersStats=1
    ShowScreenSizeStats=0
    ShowOriginStats=PH
    ShowKeyphrasesStats=1
    ShowKeywordsStats=1
    ShowMiscStats=a
    ShowHTTPErrorsStats=1
    ShowSMTPErrorsStats=0
    ShowClusterStats=0
    AddDataArrayMonthStats=1
    AddDataArrayShowDaysOfMonthStats=1
    AddDataArrayShowDaysOfWeekStats=1
    AddDataArrayShowHoursStats=1
    IncludeInternalLinksInOriginSection=0
    MaxNbOfDomain = 10
    MinHitDomain = 1
    MaxNbOfHostsShown = 10
    MinHitHost = 1
    MaxNbOfLoginShown = 10
    MinHitLogin = 1
    MaxNbOfRobotShown = 10
    MinHitRobot = 1
    MaxNbOfPageShown = 10
    MinHitFile = 1
    MaxNbOfOsShown = 10
    MinHitOs = 1
    MaxNbOfBrowsersShown = 10
    MinHitBrowser = 1
    MaxNbOfScreenSizesShown = 5
    MinHitScreenSize = 1
    MaxNbOfWindowSizesShown = 5
    MinHitWindowSize = 1
    MaxNbOfRefererShown = 10
    MinHitRefer = 1
    MaxNbOfKeyphrasesShown = 10
    MinHitKeyphrase = 1
    MaxNbOfKeywordsShown = 10
    MinHitKeyword = 1
    MaxNbOfEMailsShown = 20
    MinHitEMail = 1
    FirstDayOfWeek=1
    ShowFlagLinks=""
    ShowLinksOnUrl=1
    UseHTTPSLinkForUrl=""
    MaxLengthOfShownURL=64
    HTMLHeadSection=""
    HTMLEndSection=""
    Logo="awstats_logo6.png"
    LogoLink="http://awstats.sourceforge.net"
    BarWidth = 260
    BarHeight = 90
    StyleSheet=""
    color_Background="FFFFFF" # Background color for main page (Default = "FFFFFF")
    color_TableBGTitle="CCCCDD" # Background color for table title (Default = "CCCCDD")
    color_TableTitle="000000" # Table title font color (Default = "000000")
    color_TableBG="CCCCDD" # Background color for table (Default = "CCCCDD")
    color_TableRowTitle="FFFFFF" # Table row title font color (Default = "FFFFFF")
    color_TableBGRowTitle="ECECEC" # Background color for row title (Default = "ECECEC")
    color_TableBorder="ECECEC" # Table border color (Default = "ECECEC")
    color_text="000000" # Color of text (Default = "000000")
    color_textpercent="606060" # Color of text for percent values (Default = "606060")
    color_titletext="000000" # Color of text title within colored Title Rows (Default = "000000")
    color_weekend="EAEAEA" # Color for week-end days (Default = "EAEAEA")
    color_link="0011BB" # Color of HTML links (Default = "0011BB")
    color_hover="605040" # Color of HTML on-mouseover links (Default = "605040")
    color_u="FFAA66" # Background color for number of unique visitors (Default = "FFAA66")
    color_v="F4F090" # Background color for number of visites (Default = "F4F090")
    color_p="4477DD" # Background color for number of pages (Default = "4477DD")
    color_h="66DDEE" # Background color for number of hits (Default = "66DDEE")
    color_k="2EA495" # Background color for number of bytes (Default = "2EA495")
    color_s="8888DD" # Background color for number of search (Default = "8888DD")
    color_e="CEC2E8" # Background color for number of entry pages (Default = "CEC2E8")
    color_x="C1B2E2" # Background color for number of exit pages (Default = "C1B2E2")
    ExtraTrackedRowsLimit=500
    EOF
    
    /usr/local/awstats/tools/awstats_updateall.pl now
    
    cat > /var/www/vhosts/$1/httpdocs/logs/index.html <<EOF
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="REFRESH" content="0; URL=http://www.$1/awstats/awstats.pl?$1">
    <title>Redirection...</title>
    </head>
    <body>
    <h1>Stiller om til AWstats...</h1>
    </body>
    </html>
    EOF
    
    /etc/init.d/apache2 restart 
     
Loading...