forked from php/web-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mirroring-stats.php
76 lines (71 loc) · 2.58 KB
/
mirroring-stats.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
// $Id$
$_SERVER['BASE_PAGE'] = 'mirroring-stats.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
site_header("Setting Up Local Stats", array("current" => "community"));
?>
<h1>Setting Up Local Stats</h1>
<p>
If you are hosting an official or unofficial mirror, and you would like
to have local stats support, follow these steps. This document complements
the instructions found <a href="/mirroring.php">on the mirroring page</a>.
</p>
<ol>
<li>
<p>
<a href="http://www.mrunix.net/webalizer/">Get The Webalizer</a><br><br>
The Webalizer is a web server log analysis program. It is designed to
scan web server log files in various formats and produce usage statistics
in HTML format for viewing through a browser. Note that Webalizer requires
you to have the GD library installed on your site.
</p>
</li>
<li>
<p>
Install The Webalizer<br><br>
There is a <code>configure</code> file in the distribution now, and other setup options
are also available. Consult the <code>INSTALL</code> file included in the package.
Copy the executable to somewhere accessible, eg. <code>/usr/bin</code>.
</p>
</li>
<li>
<p>
Grab <a href="/mirror-stats.conf">mirror-stats.conf</a> and edit the file.<br><br>
This is the main conf file for The Webalizer. Specifically, you will want to
change the lines which define where your log file sits, where the output
should go, and the name of your host machine. Look for these settings:
LogFile, OutputDir, HostName, HideSite, HideReferrer. The stats
directory is not required to be in the webroot, it may be aliased
to be there (see <a href="/mirroring.php">mirroring.php</a>).
</p>
</li>
<li>
<p>
Give it a test<br><br>
From the command line in the stats directory, type:
<code>webalizer -c mirror-stats.conf</code> You should get an index
file, a usage file for the current month, some images,
and a history file.
</p>
</li>
<li>
<p>
Add it to your cron<br><br>
If all went well, in the previous step, it is ready to be updated
regularly. Something like this will be sufficient (update things
daily at 3 am):
</p>
<pre class="info">
0 3 * * * (cd /your/stats/folder;/usr/bin/webalizer -c mirror-stats.conf) >/dev/null 2>&1
</pre>
<p>
Provide the path of the stats directory in the "cd".
</p>
</li>
</ol>
<p>
If you have any questions, try to ask them on the PHP Mirrors' mailing list
(<a href="mailto:mirrors@php.net">mirrors@php.net</a>). We cannot guarantee,
that we can solve your problem, of course, but it is worth a try.
</p>
<?php site_footer(); ?>