Larry Brouwer

... just my personal technology sandbox

  • About
  • Blog
  • Archives
  • Contact

Connect

  • Email
  • Facebook
  • LinkedIn

Powered by Genesis

Adding AWStats to DotNetNuke (DNN)

April 26, 2010 By Larry Brouwer Leave a Comment

I’ve just configured AWStats to work with IIS7 on my web server (see my post, IIS7 Statistics Reporting with Log Parser and AWStats), and now I would like to integrate it into my DotNetNuke (DNN) website.

Here’s an outline of what I would like to do:

  1. Be able to log into my DNN web site as an authenticated user and navigate to a web statistics page. I don’t want anonymous users to view my stats.
  2. Create a script that runs in the background to keep the statistics up to date and have it re-generate the html page for the stats.
  3. See if I can programmatically adjust the LoadPlugin=”timezone –7” for US Central daylight savings or standard time. I really don’t want to have to remember this 2x per year.

So the first thing I did was to open the IIS7 Manager and navigate to my DNN website. I then Right Clicked on it and selected ‘Add Virtual Directory…’. I then choose ‘Statistics’ for my Alias, and navigated to the correct directory path of the AWStats webroot or ‘C:\AWStats\wwwroot’. I then opened up IE and navigated to my web site at https://www.larrybrouwer.com/stats/larrybrouwer_com_stats.html, and it displayed just fine.

My first approach to add the statistics html page was to first add a new page to the DNN website logged in as the site administrator, and then have it permanently redirect as a URL to the statistics page. At first, this seemed to work fine. The only problem was when I tried to restrict access to the file, it didn’t have any effect. In other words, I could enter the URL directly into the browser, and I could open the statistics page.

After much fiddling around with various settings, I decided to try another approach. This time, I again created a new page and deleted the default HTML module on the page. I then added an IFrame Module and set the Location to the URL for the statistics page. I set the Width and Height to 100%, checked the Auto height, disabled Scrolling and Border by setting both of them to ‘No’. This seemed to work much better. Now, when I directly enter the URL for the DNN Statistics page, it redirects me to the login screen! Pretty cool.

There’s only one catch… And that is, I can still access the statistics page by directly entering the URL of the actual page. After about 2 hours of Googling and fiddling around with Web.config settings, I came up with the solution. I went into IIS7 Manager, and selected the Statistics virtual directory. I then clicked on the Authorization Rules. I then clicked ‘Add Deny Rule…’. I then selected ‘All anonymous users’ to Deny access to anyone who isn’t a user with a valid id. So I think I’ve got it! This action resulted in a Web.config file being generated in the Statistics virtual directory (or c:\AWStats\wwwroot). Here’s the contents of the Web.config file:

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<location path=””>
<system.webServer>
<security>
<authorization>
<add accessType=”Deny” users=”?” />
</
authorization>
</security>
</system.webServer>
</location>
</configuration>

 

This concludes step 1! On to the next. The second step should be pretty straight forward. All I think I need to do is create a script with essentially two (2) steps in it. First, regenerate the AWStats, then regenerate the html for it. Here’s the script I came up with:

c:
cd \AWStats\wwwroot\cgi-bin
awstats.pl -config=www.domain.com
awstats.pl -config=www.domain.com -output -staticlinks > ..\domain_com_stats.html
exit

 

I then added the script to the Task Scheduler. I initially set it up to run every 10 minutes.

The next day (4/27/2010)

I discovered today that I’m still having issues with access security on the direct URL’s. So I decided to install AWStats directly in the DotNetNuke root folder. To me, this makes a lot more sense now, and should help me solve some problems with using virtual directories, etc. I’ll tackle that problem later today, hopefully.

I also fixed a problem with the icons not displaying correctly (see my other post for more details here).

I also updated my script to generate all the reports automatically:

#navigate to AWStats tools
G:
cd \data\www\DotNetNuke\AWStats\tools
awstats_buildstaticpages.pl -config=DotNetNuke -staticlinks -update -configdir=..\wwwroot\cgi-bin – awstatsprog=..\wwwroot\cgi-bin\awstats.pl -dir=..\wwwroot
awstats_buildstaticpages.pl -config=TechNotes -staticlinks -update -configdir=..\wwwroot\cgi-bin – awstatsprog=..\wwwroot\cgi-bin\awstats.pl -dir=..\wwwroot 

I also changed DNN to allow for uploading of .html files. Host / Host Settings / Advanced Settings / Other Settings / Allowable File Extensions which in an attempt to fix my file security issues. More on that later.

Filed Under: Notable Tagged With: AWStats, DotNetNuke, IIS7

Leave a Reply

You must be logged in to post a comment.

Recent Posts

  • Weaver’s Bamboo “Bambusa textilis” clumping bamboo for sale
  • configuring NTP Service on FreeNas, XenServer, and virtualized Windows Server 2012 R2 Domain Controller
  • CentOS 7 Warning: Your Magento folder does not have sufficient write permissions.
  • AOE Scheduler 1.3.0 cron issue with Magento 1.9.2.2

Tag cloud

IIS7 Maytag PHP Port 25 ASP.Net SmarterMail Azure Silverlight mstsc.exe SSL SBS2011 Tools Blogs Visual Studio Magento CentOS PrestaShop Spam Database Mail PST SVN MySQL eCommerce clumping bamboo DIR-655 iframe OpenCart DotNetNuke Log Parser Yahoo Mail Security AWStats redirect Comcast Outlook 2007 Neptune D-Link Windows 7 Exchange 2010 SqlServer TomatoCart BlogEngine.Net C# WordPress Outlook Connector