{"id":1,"date":"2011-09-07T09:14:46","date_gmt":"2011-09-07T13:14:46","guid":{"rendered":"http:\/\/mufljuz.com\/?p=1"},"modified":"2014-09-23T10:44:57","modified_gmt":"2014-09-23T14:44:57","slug":"hello-world","status":"publish","type":"post","link":"https:\/\/www.mufljuz.com\/?p=1","title":{"rendered":"Awstats &#038; virtual hosts"},"content":{"rendered":"<p>Gentoo has finaly moved away from webapp-config and simplified updating awstats. The example of apache config file setting awstats for apache virtual hosts runnig wsgi application is given bellow. Prerequisites are apache proxy for wsgi app, and awstats visible at www.some_domain.com\/awstats.pl using authentication.<\/p>\n<pre>\r\n    &lt;VirtualHost *:80&gt;\r\n        ServerName www.some_domain.com\r\n        Serveralias some_domain.com\r\n        ServerAdmin admin@some_domain.com\r\n\r\n        ErrorLog \/var\/log\/apache2\/www.some_domain.com-error.log\r\n        CustomLog \/var\/log\/apache2\/www.some_domain.com-access.log combined\r\n\r\n        # awstats config\r\n        Alias \/awstats\/classes \"\/usr\/share\/awstats\/wwwroot\/classes\/\"\r\n        Alias \/awstats\/css \"\/usr\/share\/awstats\/wwwroot\/css\/\"\r\n        Alias \/awstats\/icon \"\/usr\/share\/awstats\/wwwroot\/icon\/\"\r\n        ScriptAlias \/awstats\/ \"\/usr\/share\/awstats\/wwwroot\/cgi-bin\/\"\r\n        ScriptAlias \/awstats \"usr\/share\/awstats\/wwwroot\/cgi-bin\/awstats.pl\u201d\r\n        ScriptAlias \/awstats.pl \"usr\/share\/awstats\/wwwroot\/cgi-bin\/awstats.pl\u201d\r\n\r\n        &lt;Directory \"\/usr\/share\/awstats\/wwwroot\"&gt;\r\n                AllowOverride None\r\n                Options None\r\n                Order allow,deny\r\n                Allow from all\r\n\r\n                AuthType Basic\r\n                AuthName \"AWStats authenticated zone\"\r\n                AuthUserFile \/etc\/awstats\/.htpasswd\r\n                Require valid-user\r\n        &lt;\/Directory&gt;\r\n        &lt;Directory \"\/usr\/share\/awstats\/wwwroot\/cgi-bin\"&gt;\r\n                SetHandler cgi-script\r\n                Options +ExecCGI\r\n        &lt;\/Directory&gt;\r\n\r\n        ProxyPass \/awstats !\r\n        ProxyPass \/awstats.pl !\r\n\r\n        ProxyPass \/ http:\/\/localhost:5005\/ retry=5\r\n        ProxyPassReverse \/ http:\/\/localhost:5001\/\r\n        ProxyPreserveHost On\r\n        &lt;Proxy *&gt;\r\n            Order deny,allow\r\n            Allow from all\r\n        &lt;\/Proxy&gt;\r\n    &lt;\/VirtualHost&gt;\r\n<\/pre>\n<p>Awstats config file (in \/etc\/awstats\/) with geo-ip (<code>emerge dev-perl\/Geo-IP<\/code>)<\/p>\n<pre>LogFile=\"\/var\/log\/apache2\/www.some_domain.com-access.log\"\r\n\r\nLogType=W\r\nLogFormat=1\r\nLogSeparator=\" \"\r\nHostAliases=\"localhost 127.0.0.1 REGEX[myserver\\.com$]\"\r\nDNSLookup=2\r\nDirCgi=\"\/cgi-bin\"\r\nDirIcons=\"\/awstats\/icon\"\r\nAllowToUpdateStatsFromBrowser=0\r\nAllowFullYearView=2\r\n\r\nLevelForFileTypesDetection=1\r\nLevelForWormsDetection=2\r\n\r\nSiteDomain=\"www.some_domain.com\"\r\nDirData=\"\/home\/some_user\/awstats\"\r\n\r\nLoadPlugin=\"geoip GEOIP_STANDARD \/usr\/share\/GeoIP\/GeoIP.dat\"<\/pre>\n<p>To test configuration run<br \/>\n<code>\/usr\/share\/awstats\/wwwroot\/cgi-bin\/awstats.pl -config=www.some_domain.com -update<\/code><\/p>\n<p>If you wish cron to handle update on every hour:<br \/>\n<code>crontab -e -usome_user<\/code><\/p>\n<pre>0 * * * * cd \/etc\/awstats\/ &amp;&amp; \/usr\/share\/awstats\/wwwroot\/cgi-bin\/awstats.pl  -config=www.some_domain.com -update  &gt;\/dev\/null 2&gt;&amp;1<\/pre>\n<p><strong>Error with log file<\/strong><\/p>\n<pre>Error: LogFile parameter is not defined in config\/domain file\r\nSetup ('www.dajstadas.com' file, web server or permissions) may be wrong.\r\nCheck config file, permissions and AWStats documentation (in 'docs' directory).<\/pre>\n<p>obviously check LogFile and read permissions, however, this might fail if you call awstats update outside \/etc\/awstats directory. Retry with<\/p>\n<p><code><br \/>\ncd \/etc\/awstats\/ &amp;&amp; \/usr\/share\/awstats\/wwwroot\/cgi-bin\/awstats.pl -config=www.some_domain.com -update<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gentoo has finaly moved away from webapp-config and simplified updating awstats. The example of apache config file setting awstats for apache virtual hosts runnig wsgi application is given bellow. Prerequisites are apache proxy for wsgi app, and awstats visible at www.some_domain.com\/awstats.pl using authentication. &lt;VirtualHost *:80&gt; ServerName www.some_domain.com Serveralias some_domain.com ServerAdmin admin@some_domain.com ErrorLog \/var\/log\/apache2\/www.some_domain.com-error.log CustomLog \/var\/log\/apache2\/www.some_domain.com-access.log [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,13,1],"tags":[14,16,17,15],"_links":{"self":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts\/1"}],"collection":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1"}],"version-history":[{"count":12,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":57,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions\/57"}],"wp:attachment":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}