Raspberry Pi as server

Setup & config options

Apache 2.4+ LAMP server

»Windward« server

The game & not the islands
 Setup & config options

Some off-topics
Free weather app. Weather widget

Lat. 52.27, Long. 8.01

 

Meteorological service

Front desk clerk

🚫  No ads & tracking

Tag cloud
QRC bookmark

QR quick response code



Github social media VSCO social media Vimeo social media | Madeira | Madeirense Twitter | X Youtube social media

The prologue


Most of the articles, descriptions and instructions written here are applicable to the most common Debian-based Linux derivatives. Depending on the respective operating system, there may be minor or major discrepancies.
This website is for educational purposes only. Please do not deploy anything in manufacturing plants.
No warranty or compensation is given for loss of data or hardware.

It should be also mentioned that this modest web server is hosted on a Raspberry Pi type 4B at home.


The Raspberry Pi mini-computer board as multi-purpose server deployed
A competent allrounder for domestic purposes and micro-enterprises


Raspberry Pi : Apache as multiple web server. Print server, scan server, backup and NAS server. Raspberry Pi : Apache as multiple web server. Print server, scan server, backup and NAS Server.

Raspberry Pi is a series of small single-board computers (SBCs) developed in the United Kingdom by the Raspberry Pi Foundation in association with Broadcom. The mini-computer with its armv7l processor has quickly become the favourite of hobbyists. Projects can be started with suitable Linux distributions. Even an aged RasPi e.g. the models 2B and 2B+ can definitely serve to simple tasks quite well.


Installation & configuration of Webalizer analyzer with your Apache v2.4+ web server


Webalizer Logo PNG. Webalizer sample reports. Webalizer theme download.

This guide is mainly valid if you deal with :

  • Raspberry Pi and Raspbian OS
  • Apache web server v2.2 or v2.4+
  • Any other Debian Linux version

And still until now, the internet domain http://mrunix.net (†) is down.

Since the month of Septembre 2021 it have no more updates on GeoDB.dat.


Never mind and don't worry. The Webalizer also is functional with the latest GeoIP.dat database.


root@raspberry:/home/user# nano /etc/webalizer/webalizer.conf


        # GeoDB   no
        # GeoDBDatabase     /usr/share/GeoDB/GeoDB.dat
        GeoIP     yes
        GeoIPDatabase       /usr/share/GeoIP/GeoIP.dat
	

https://dosboot.org/files/download.html ➔ Download the lastest the GeoIP.dat.

https://dosboot.org/survey/usage_202403.html


01-Jun 2022
Updated 29-Mar 2024


Google Analytics versus Webalizer


A fact about Google Analytics : visitors with AdBlocker and / or cookies disabled will not be tracked. Because Google Analytics uses first party cookies (cookies set and read by the same domain currently shown in your address bar) and THE NUMBERS OF REAL USERS THAT WILL BLOCK THOSE COOKIES ARE INCREASING. And, at the same time, this prevents Google Analytics from tracking visits from automated spiders and other systems that don't interpret JavaScript.


Webalizer will show all requests of the server recorded in the server Apache log files. It doesn't actually interact with the browser at all. One benefit of this is that you can see how often certain elements of a webpage have been accessed - such as particular images, CSS files, PDFs, RARs and ZIPs and other non-page elements.


Prologue


The Webalizer (†) is a fast, free web server log file analysis program. It produces highly detailed, easily configurable usage reports in a simple HTML format, for viewing in all standard web browsers.


Webalizer Logo PNG. Webalizer sample reports. Webalizer theme download.

http://www.webalizer.org/sample/index.html (†).

Output produced


The Webalizer produces several reports in html & png for each month processed. In addition, a summary page is generated for the current and previous months, a history file is created and if incremental mode is used, the current month's processed data. The main files & graphics produced are:


      index.html                 # main summary page
      usage_YYYYMM.html          # monthly summary page

      usage.png                  # yearly graph displayed on the main index page
      usage_YYYYMM.png           # monthly usage graph for specified month/year
      daily_usage_YYYYMM.png     # daily usage graph for specified month/year
      hourly_usage_YYYYMM.png    # hourly usage graph for specified month/year

      site_YYYYMM.html           # all hosts listing **
      url_YYYYMM.html            # all urls listing **
      ref_YYYYMM.html            # all referrers listing **
      agent_YYYYMM.html          # all user agents listing **
      search_YYYYMM.html         # all search strings listing **

      webalizer.hist             # previous month history
      webalizer.current          # incremental data **

                                 # ** if enabled
      

🚫 Personalized spam filter | Anti ghost spam


Webalizer referrer spamming, ghost spam, referal spam.

For all the precautions, cutbacks, eliminations and preventions.
Right before you start with anything to install.
Please read that to get advised by this essential article.


Installation & configuration


Start e.g. the PuTTy terminal client and log-in to begin the session.


user@raspberry:~ $ sudo su
root@raspberry:~# apt install webalizer


📑 The man command displays the user manual of any command that we run on the terminal.


root@raspberry:~# man webalizer


You can find here the original README from 2013 webalizer-manpage.txt .


Now enable the apache2 hostname resolution.


root@raspberry:~# nano /etc/apache2/apache2.conf


        HostnameLookups Off
        HostnameLookups On
        
Save Ctrl O the file apache2.conf and close Ctrl X the nano editor.

Change default folder and path


With OLDER Linux distributions the default path after installation is :


/var/www/webalizer


root@raspberry:~# nano /etc/webalizer/webalizer.conf


        OutputDir /var/www/webalizer   =>   OutputDir /var/www/html/host-traffic
        

The folders /webalizer/ and /stats/ are quit common in the worldwide web. Since bad bots crawl the web for those known folders mostly to send you ghost referral spam, it is recommended to choose a different name and do never ever submit to search engines and web listings. For the demonstrative purpose we deploy /survey/ here.


Save Ctrl O the file webalizer.conf and close Ctrl X the nano editor.


Essential point : You have to make manually a directory named e.g. /survey/ with the help of https://filezilla-project.org or any other FTP program on your Rasbpi web server underneath the directory /var/www/html. Otherwise the Webalizer spits a bunch of error messages.


root@raspberry:~# cd /var/www/html
root@raspberry:~# mkdir host-traffic


Remove the standard directory.


root@raspberry:~# cd /var/www
root@raspberry:~# rm -rf webalizer


Restart services


You made some modifications. Restart Apache before you test the Webalizer configuration.


root@raspberry:~# service apache2 restart


Initial test. You get the first evaluation data about the server usage in image and text.


root@raspberry:~# sudo /etc/cron.daily/webalizer


The server evaluation has filed and is now accessible under:


        http://yourdomain.tld/survey/index.html
        http://yourIP/survey/index.html
        

From now on CronD (software utility Cron is a time-based job scheduler in computer operating systems) does update automatically every 24 hours.


Statistics only showing one or two days


    Trouble shooting


Get version and configuration.


root@raspberry:~# webalizer -vV


In case the webalizer statistics of your website are only showing the last one or two days instead of all days since webalizer has been installed on your system, you have to activate incremental processing in the webalizer configuration file /etc/webalizer/webalizer.conf.


root@raspberry:~# nano /etc/webalizer/webalizer.conf


Uncomment and change the line


        #Incremental no 
        Incremental yes
        

Option Incremental if set to yes tells Webalizer only to process partial logs, and allows to rotate log files as much as you want without loss of information.

It's recommended to set this option always to yes.


Optional - flag package


Flag Argentina Flag Belgium Flag Denmark Flag UK United Kingdom Flag Norway Flag Spain Flag RSA South Africa Flag Australia Flag Cuba Flag France Flag Jamaica


Country flag graphics for display in generated reports (Top Total Countries). Based on the country flag graphics for geolocation support. You can download the origin flag package from Webalizer's homepage. Extract and place all files to /var/www/html/images/flags .


root@raspberry:~# nano /etc/webalizer/webalizer.conf


Uncomment and change the line

        #CountryFlags no
        CountryFlags yes
        
It's more a graphical gimmick than a useful thingy.


        /<root>
        /var/www/html
        /var/www/html/host-traffic
        /var/www/html/images/flags
        

Update search engine referrers


          # The SearchEngine keywords allow specification of search engines and
          # their query strings on the URL.  These are used to locate and report
          # what search strings are used to find your site.  The first word is
          # a substring to match in the referrer field that identifies the search
          # engine, and the second is the URL variable used by that search engine
          # to define its search terms.
          

Search engines' keywords will tell Webalizer how to extract the referrer strings that are useful for your keyword research. The default section is OUTDATED. Currently deploying an updated section.


root@raspberry:~# nano /etc/webalizer/webalizer.conf


          SearchEngine    google.         url=
          SearchEngine    google.         q=
          SearchEngine    bing.com        q=
          SearchEngine    yahoo.          p=
          SearchEngine    aol.            query=
          SearchEngine    aolsearch.      q=
          SearchEngine    ask.            q=
          SearchEngine    eureka.com      Ntt=
          SearchEngine    lycos.          q=
          SearchEngine    excite.         q=
          SearchEngine    answers.        q=
          SearchEngine    webcrawler.     q=
          SearchEngine    infospace.      q=
          SearchEngine    baidu.          wd=
          SearchEngine    duckduckgo.     q=
          SearchEngine    startpage.com   ep=
          SearchEngine    archive.        query=
          SearchEngine    yandex.         search=
          SearchEngine    search.         q=
          SearchEngine    dogpile.        q=
          SearchEngine    ixquick.com     ep=
          SearchEngine    info.           qkw=
          SearchEngine    wolframalpha.   i=
          SearchEngine    gigablast.com   q=
          SearchEngine    looksmart.com   q=
          

Next section is up to you.


          AllReferrers  yes/no
          AllSearchStr  yes/no
          

Optional - update GeoDB.dat


Link to get the latest Geolocation database »/usr/share/GeoDB« provided by The Webalizer.
MrUnix GeoDB database via FTP-server, external link.


Upload GeoDB.dat to root an copy it to /usr/share/GeoDB


root@raspberry:~# cp GeoDB.dat /usr/share/GeoDB


Set in /etc/webalizer/webalizer.conf


        # The GeoDB option enables or disabled the use of the native
        # Webalizer GeoDB geolocation services.
        #GeoDB   yes/no
        #GeoDBDatabase   /usr/share/GeoDB/GeoDB.dat
        

and uncomment #GeoDB #GeoDBDatabase if wanted

Troubleshooting | ftp


It might be that your current browser does not support the file transfer protocol »ftp« anymore.

Simply start the remote-terminal e.g. PuTTy if you operate in the socalled »headless mode« or if not the console / terminal on your Raspberry Pi.


root@raspberry:~# wget ftp://ftp.mrunix.net/pub/webalizer/webalizer-geodb-latest.tgz -P /home/pi/Downloads
root@raspberry:~# tar -xf /home/pi/Downloads/geodb-latest.tgz
root@raspberry:~# cp /home/pi/Downloads/GeoDB.dat /usr/share/GeoDB


I have a mirror page here : //dosboot.org/files/download.html.

24-Mar 2020


CSS style sheet - personalized theme


It is possible to customize Webalizer's default theme.


root@raspberry:~# nano /etc/webalizer/webalizer.conf


Scroll down and locate the section HTMLHead and add the path to the CSS file.


    HTMLHead <link rel="stylesheet" type="text/css" href="/path_to/host-traffic.css">
	  

Demonstration :


          /* style sheet removes awful borders from tables and cells */

          @charset "UTF-8";

          @viewport {
              zoom: 1.0;
              width: device-width;
          }

          table {
              border: 0px;
              margin-left: auto;
              margin-right: auto;
              width: 900px;
              padding: 5px;
          }
          
          td, tr, th {
              border: 0px;
          }
          

Afterwards run once this command and get the updated results.


root@raspberry:~# sudo webalizer -d

root@raspberry:~# nano /etc/webalizer/webalizer.conf


        # The custom graph colors are defined here. Declare them
        # in the standard hexadecimal way (as HTML, without the '#')
        # If none are given, you will get the standard default colors.

        #ColorHit       00805C
        #ColorFile      0040FF
        #ColorSite      FF8000
        ColorKbyte      C11B17
        #ColorIKbyte    0080FF
        #ColorOKbyte    00E000
        ColorPage       87AFC7
        ColorVisit      FFDB58
        ColorMisc       87AFC7
        

10-Nov 2017
Updated 01-May 2021


Language settings


Webalizer uses Gettext, so it will generate statistics on the default locale of your system.


root@raspberry:~# locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
root@raspberry:#


Changing the default system locale:


root@raspberry:~# update-locale LANG=xx_XX.UTF-8


or shortwise via raspi-config:


root@raspberry:~# dpkg-reconfigure locale


Momentarily force Webalizer in another language simply changing the LANG:


root@raspberry:~# export LANG=xx_XX.UTF-8; webalizer


Languagexx_XX.UTF-8
Danishdk_DK.UTF-8
Dutchnl_NL.UTF-8
English-GBen_GB.UTF-8
English-USen_US.UTF-8
Finnishfi_FI.UTF-8
Frenchfr_FR.UTF-8
Germande_DE.UTF-8
Italianit_IT.UTF-8
Japaneseja_JP.UTF-8
Norwegianno_NO.UTF-8
Portuguesept_PT.UTF-8
Portuguese-BRApt_BR.UTF-8
Russianru_RU.UTF-8
Spanishes_ES.UTF-8
Swedishsv_SV.UTF-8

UTF-8 and UTF-16 encode exactly the same set of characters. UTF-16 uses uniformly 16 bits to represent a character; while UTF-8 uses 1, 2, or 3 bytes depending on the character, so that an ASCII character is represented still as 1 byte. The most recent web browsers support UTF-16.


17-Nov 2017


Webalizer | Personalized spam absorber


»IgnoreReferrer name« = Ignores all referrers that match »name« even if just partly.


Now take the terminal text editor and edit the configuration file, which we'll assume here is »/etc/webalizer/webalizer.conf«. The configuration file is a series of keywords and values, where empty lines and lines beginning with hash marks (#) are ignored.


user@raspberry:~ $ sudo su
[sudo] Password for user: ******
root@raspberry:/home/user# nano /etc/webalizer/webalizer.conf


You may copy the text snipped and paste this in the appropriate section where »yourdomain.« stands for your second-level domain name.



Open file in new tab | Download the text file


20-Jul 2019

Updated 25-Nov 2021


Webalizer | Grouping (UA) User-agents


Recently I had to think about setting up my own configurations for »Webalizer« : grouping the User-agents into meaningful sections. The result is a pretty clean config that handles - from my experience - about 95% of my incoming traffic. With more upcomming User-agents it's getting more and more difficult to sort them out.

»Webalizer« deploys it's config-file from the top to the bottom. I will continue to get the best output results.



Open file in new tab | Download the text file


16-Sep 2019

Updated 31-Jan 2021


Troubleshooting | Webalizer and Varnish caching proxy


»Varnish« (mem/ram caching service) comes with its own logging feature and entries to
/var/log/apache2/access.log are suppessed. This is quit bad if you also deploy »Webalizer« for server usage reports.


»Varnish« can use »varnishncsa« as a service which generates /var/log/varnish/varnishncsa.log.


I figured out how to use »Webalizer« and »Varnish« together : Varnish caching proxy.


In addition you have to modify the webalizer.conf.


user@raspberry:~ $ sudo su
root@raspberry:/home/user# nano /etc/webalizer/webalizer.conf


        # LogFile  /var/log/apache2/access.log.1
        LogFile    /var/log/varnish/varnishncsa.log.1
        # LogType  clf
		

Save Crtl O and exit Crtl X.


04-Oct 2019

dosboot.org 2024 | Design and layout handmade in Northwest Europe