# apache 2.0, 2.2, awstats 6.5, 6.5-r1 no auth dialog[solved]

## newtonian

Hi-

I'm testing an upgrade from apache 2.0 --> 2.2 and awstats 6.5 --> 6.5-r1.

Apache seems to be working now, but I'm having trouble getting apache to 

display the basic authentication dialog.  Instead of getting the dialog

after typing in "http://mydomain.com/awstats.pl" the following error message is 

displayed:

```

Error: Access to statistics is only allowed from an authenticated session to authenticated users.

Setup ('/etc/awstats/awstats.mydomain.com.conf' file, web server or permissions) may be wrong.

Check config file, permissions and AWStats documentation (in 'docs' directory).
```

Log files

tail -f /var/log/apache2/error_logdoesn't display any error messages.

/var/log/apache2/access_log displays:

```
 219.117.245.123 - - [09/Dec/2007:05:49:03 +0900] "GET /awstats.pl HTTP/1.1" 200 871

mydomain.com 219.117.245.111 - - [09/Dec/2007:05:49:03 +0900] "GET /awstats.pl HTTP/1.1" 200 871 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20070201 BonEcho/2.0.0.1"
```

Here are my conf files:

hawk-upgrade apache2 # cat /etc/apache2/awstats.conf

```

Alias /awstats/classes "/usr/share/webapps/awstats/6.5-r1/htdocs/classes/"

Alias /awstats/css "/usr/share/webapps/awstats/6.5-r1/htdocs/css/"

Alias /awstats/icons "/usr/share/webapps/awstats/6.5-r1/htdocs/icon/"

ScriptAlias /awstats/ "/usr/share/webapps/awstats/6.5-r1/hostroot/cgi-bin/"

ScriptAlias /awstats "/usr/share/webapps/awstats/6.5-r1/hostroot/cgi-bin/awstats.pl"

ScriptAlias /awstats.pl "/usr/share/webapps/awstats/6.5-r1/hostroot/cgi-bin/awstats.pl"

<Directory "/usr/share/webapps/awstats/6.5-r1/htdocs">

    Options None

    AllowOverride None

    <IfModule mod_access.c>

        Order allow,deny

        Allow from all

    </IfModule>

</Directory>

<Directory "/usr/share/webapps/awstats/6.5-r1/hostroot/cgi-bin">

    Options ExecCGI

    AllowOverride None

    <IfModule mod_access.c>

        Order allow,deny

        Allow from all

    </IfModule>

</Directory>

<IfModule mod_auth.c>

<Directory "/usr/share/webapps/awstats/6.5-r1/hostroot">

    Options ExecCGI

    AllowOverride None

    Order allow,deny

    Allow from all

    AuthType Basic

    AuthName "AWStats authenticated zone"

    AuthUserFile /etc/awstats/.htpasswd

    Require valid-user

</Directory>

</IfModule>

```

permissions 

```
ls -l /usr/share/webapps/awstats/6.5-r1/

total 28

drwxr-xr-x 2 root root 4096 2007-12-09 04:24 conf

drwxr-xr-x 2 root root 4096 2007-12-09 04:24 hooks

drwxr-xr-x 6 root root 4096 2007-12-09 04:24 hostroot

drwxr-xr-x 6 root root 4096 2007-12-09 04:24 htdocs

-rw-r--r-- 1 root root    0 2007-12-09 04:24 installed_by_webapp_eclass

-rw-r--r-- 1 root root 5082 2007-12-09 04:24 postinst-en.txt

drwxr-xr-x 2 root root 4096 2007-12-09 04:24 sqlscripts
```

vhosts.conf[b]

```
#### mydomain.com ###########################################

<VirtualHost *:80>

ServerName  mydomain.com

ServerAlias www.mydomain.com

DocumentRoot /var/www/mydomain.com/htdocs

<directory "/var/www/mydomain.com/htdocs">

        Options ExecCGI

        AllowOverride All

        Order allow,deny

        Allow from all

</directory>

</VirtualHost>
```

httpd.conf

```
hawk-upgrade apache2 # tail /etc/apache2/httpd.conf

# Virtual-host support

#

# Gentoo has made using virtual-hosts easy. In /etc/apache2/vhosts.d/ we

# include a default vhost (enabled by adding -D DEFAULT_VHOST to

# APACHE2_OPTS in /etc/conf.d/apache2).

Include /etc/apache2/vhosts.d/*.conf

Include /etc/apache2/awstats.conf

# vim: ts=4 filetype=apache

```

awstats.mydomain.com.conf

```
hawk-upgrade awstats # cat awstats.mydomain.com.conf

LogFile="/var/log/apache2/access_log"

LogType=W

#LogFormat=1

LogFormat="%virtualname %host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot"

LogSeparator=" "

SiteDomain="mydomain.com"

HostAliases="REGEX[nagisatei\.info$]"

DNSLookup=2

DirData="/var/www/mydomain.com/awstats"

DirCgi="/cgi-bin/awstats"

DirIcons="/awstats/icons"

AllowToUpdateStatsFromBrowser=0

AllowFullYearView=2

EnableLockForUpdate=0

DNSStaticCacheFile="dnscache.txt"

DNSLastUpdateCacheFile="dnscachelastupdate.txt"

SkipDNSLookupFor=""

AllowAccessFromWebToAuthenticatedUsersOnly=1

AllowAccessFromWebToFollowingAuthenticatedUsers="tiny david"

AllowAccessFromWebToFollowingIPAddresses=""

CreateDirDataIfNotExists=0

BuildHistoryFormat=text

BuildReportFormat=html

SaveDatabaseFilesWithPermissionsForEveryone=1

PurgeLogFile="/var/log/apache/access_log"

ArchiveLogRecords=0

KeepBackupOfHistoricFiles=0

DefaultFile="index.html"

SkipHosts=""

SkipUserAgents=""

SkipFiles=""

OnlyHosts=""

OnlyUserAgents=""

OnlyFiles=""

NotPageList="css js class gif jpg jpeg png bmp ico"

ValidHTTPCodes="200 304"

ValidSMTPCodes="1 250"

AuthenticatedUsersNotCaseSensitive=0

URLNotCaseSensitive=0

URLWithAnchor=0

URLQuerySeparators="?;"

URLWithQuery=0

URLWithQueryWithOnlyFollowingParameters=""

URLWithQueryWithoutFollowingParameters=""

URLReferrerWithQuery=0

WarningMessages=1

ErrorMessages=""

DebugMessages=1

NbOfLinesForCorruptedLog=50

WrapperScript=""

DecodeUA=0

MiscTrackerUrl="/js/awstats_misc_tracker.js"

LevelForBrowsersDetection=2         # 0 disables Browsers detection.

                                    # 2 reduces AWStats speed by 2%

LevelForOSDetection=2               # 0 disables OS detection.

                                    # 2 reduces AWStats speed by 3%

LevelForRefererAnalyze=2            # 0 disables Origin detection.

                                    # 2 reduces AWStats speed by 14%

LevelForRobotsDetection=2           # 0 disables Robots detection.

                                    # 2 reduces AWStats speed by 2.5%

LevelForSearchEnginesDetection=2    # 0 disables Search engines detection.

                                    # 2 reduces AWStats speed by 9%

LevelForKeywordsDetection=2         # 0 disables Keyphrases/Keywords detection.

                                    # 2 reduces AWStats speed by 1%

LevelForFileTypesDetection=2        # 0 disables File types detection.

                                    # 2 reduces AWStats speed by 1%

LevelForWormsDetection=0            # 0 disables Worms detection.

                                    # 2 reduces AWStats speed by 15%

UseFramesWhenCGI=1

DetailedReportsOnNewWindows=1

Expires=0

MaxRowsInHTMLOutput=1000

Lang="auto"

DirLang="./lang"

ShowMenu=1

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

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")

```

Any ideas much appreciated.

Cheers,Last edited by newtonian on Mon Jan 28, 2008 7:10 am; edited 1 time in total

----------

## newtonian

apache changed the mod names so you have to do this to get around the issue:

# change

```
<Directory "/usr/share/webapps/awstats/6.5/htdocs">

    Options None

    AllowOverride None

    <IfModule mod_access.c>

        Order allow,deny

        Allow from all

    </IfModule>

</Directory>
```

# to

```

<Directory "/usr/share/webapps/awstats/6.5/htdocs">

    Options None

    AllowOverride None

#    <IfModule mod_access.c>

        Order allow,deny

        Allow from all

#    </IfModule>

</Directory>

```

# change:

```
<IfModule mod_auth.c>

<Directory "/usr/share/webapps/awstats/6.5/hostroot">
```

# to:

```
<IfModule mod_auth_basic.c>

<Directory "/usr/share/webapps/awstats/6.5/hostroot">
```

Cheers,

----------

## biggyL

newtonian

I don't use <IfModule ..> directive here at all (below is your code):

```

<IfModule mod_auth_basic.c> 

<Directory "/usr/share/webapps/awstats/6.5-r1/hostroot"> 

    Options ExecCGI 

    AllowOverride None 

    Order allow,deny 

    Allow from all 

    AuthType Basic 

    AuthName "AWStats authenticated zone" 

    AuthUserFile /etc/awstats/.htpasswd 

    Require valid-user 

</Directory> 

</IfModule> 

```

Is it necessary to put it there?

----------

## newtonian

 *biggyL wrote:*   

> newtonian
> 
> I don't use <IfModule ..> directive here at all (below is your code):
> 
> ```
> ...

 

Is everything working for without the "if module" declaration?

If everything works without the declaration you should be fine.

Cheers,

----------

