Statistics outside of document root

Discussion in 'Installation/Configuration' started by fatbear, Feb 14, 2016.

  1. fatbear

    fatbear Member HowtoForge Supporter

    Presently, statistics resides inside the document root:
    /var/www/clients/<clientNNN>/<webNNN>/web/stats
    I need to to have the statistics (either AWStats or Webalizer) to reside outside of the document root. Several reasons exist for this:
    • Some customers have Joomla and its .htaccess prevents the /stats directory from being accessed. A 404 error is thrown.
    • Some customers have their own /stats directory under the /web directory for other purposes. They still want website statistics, but with a name that doesn't conflict with their existing website designs.
    • It would seem to be better privacy management to have this data outside of the document root. I think an appropriate location would be:
      /var/www/clients/<clientNNN>/<webNNN>/stats
    Does ISPConfig make this possible? Otherwise:
    • Can you suggest how I can modify the .htaccess file that Joomla installs to completely ignore the /stats directory. I've tried the following, but it hasn't worked:
      RewriteRule ^/stats(/|$) - [L]
    • Can you suggest how I can change the name of the directory from /stats to some other name?
     
  2. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Unfortunally stats dir is always beeing created
    /usr/local/ispconfig/server/cron_daily.php:303
    $statsdir = escapeshellcmd($rec['document_root'].'/'.($rec['type'] == 'vhostsubdomain' ? $rec['web_folder'] : 'web').'/stats');
    which is explicitly passed to the webalizer command call.

    Did you check wether your 404 is caused by this: http://forum.joomla.org/viewtopic.php?f=624&t=826747 ?
     
  3. fatbear

    fatbear Member HowtoForge Supporter

    Yes, I've seen that web page and it hasn't helped. By the way, I also noticed that for CentOS 7, webalizer isn't even available. So, the question really will be limited to AWStats. I'm still looking to get this working. But, I'd hate to do a hack on the ISPConfig code.
     
  4. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Renaming the stats directory probably won't work - I assume Joomla is rerouting every request to it's index.php
    Does a direct call like domain.tld/stats/index.html work?
    What happens if you add
    RewriteEngine Off
    to the .htaccess file inside stats directory? Probably not a permanent solution since it probably gets overwritten if you change stats password but you could add it as custom apache config for Joomla sites like
    <Directory /path/stats>
    RewriteEngine Off
    </Directory>

    I don't have the ability to really test that - but it might work.
     
  5. fatbear

    fatbear Member HowtoForge Supporter

    Found the problem. I had to change:
    Server Config > myserver > Web > AWStats Settings > awstats.pl script
    = /usr/share/awstats/wwwroot/cgi-bin/awstats.pl

    The default value was wrong. It turned out that the RewriteRule was not needed.
    This still doesn't help the customers who need the stats directory for their own uses, but it does get those customers with Joomla in good shape. I guess I can either hack the code, or see if there is a better long-term solution for ISPConfig not making assumptions about what it can do with the contents of a user's document root directory.
     
  6. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Yeah, it's a pitty it seems to be hardcoded :( I'd appreciate to move stats and error directories outside document-root or at least let domain owners change their names.
     

Share This Page