---
title: Deploying AWStats
description: How to deploy AwStats to generate advanced web, streaming, FTP, or mail server statistics graphically.
products:
  - instances
tags: AwStats FTP Apache
dates:
  validation: 2025-05-02
  posted: 2018-12-03
  validation_frequency: 12
difficulty: beginner
usecase:
  - application-hosting
ecosystem:
  - third-party
---
import image from './assets/scaleway-awstats_homepage.webp'

import Requirements from '@macros/iam/requirements.mdx'


AwStats serves as a valuable utility capable of providing a comprehensive overview of your website's activity while aiding in site analysis. This open-source web analytics reporting tool generates advanced statistics for web, streaming, FTP, and mail servers in a visually informative manner.

This software stands as a robust, enterprise-level server and log monitoring solution, offering two operational modes: CGI (Common Gateway Interface) and command line. It efficiently presents log data through concise and graphical web pages, with regular and swift updates.

AwStats leverages log file analysis to parse data from a wide range of web servers, including Apache, IIS, and numerous others.

<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- An [SSH key](/organizations-and-projects/how-to/create-ssh-key/)
- An [Instance](/instances/how-to/create-an-instance/)
- `sudo` privileges or access to the root user

<Message type="tip">
  We recommend you follow this tutorial using a [General Purpose Instance](/instances/reference-content/general-purpose/).
</Message>

## Installing Apache

1. Connect to your Instance:

    ```
    ssh root@<your_Instance_public_IP>
    ```

2. Make sure the Apache2 HTTP server is installed, then install the AwStats server packages:

    ```
    apt update
    apt install apache2
    ```

## Installing and configuring AwStats

By default, AwStats package is available in the Ubuntu repository.

1. Install the AwStats package.
    ```
    apt install awstats
    ```
2. Enable the CGI module in Apache.
    ```
    a2enmod cgi
    ```
3. Restart Apache.
    ```
    systemctl restart apache2.service
    ```
4. Duplicate the AwStats default configuration file to one with your domain name.
    ```
    cp /etc/awstats/awstats.conf /etc/awstats/domain-example.conf
    ```
5. Edit your AwStats domain name configuration file.
    ```
    nano /etc/awstats/domain-example.conf
    ```
6. Update the settings shown below.
    ```
    # Change to Apache log file, by default it's /var/log/apache2/access.log
    LogFile="/var/log/apache2/access.log"

    # Change to the website domain name
    SiteDomain="domain-example.com"
    HostAliases="www.domain-example localhost 127.0.0.1"

    # When this parameter is set to 1, AwStats adds a button on report page to allow to "update" statistics from a web browser
    AllowToUpdateStatsFromBrowser=1
    ```
7. Type `CTRL + O` and `CTRL + X` to save and exit the file.
8. Build your initial statistics which are generated from the current logs on your server.
    ```
    /usr/lib/cgi-bin/awstats.pl -config=test.com -update
    ```

    which returns

    ```
    ...
    Create/Update database for config "/etc/awstats/awstats.conf" by AwStats version 7.6 (build 20161204)
    From data in log file "/var/log/apache2/access.log"...
    Phase 1 : First bypass old records, searching new record...
    Searching new records from beginning of log file...
    Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
    Jumped lines in file: 0
    Parsed lines in file: 5
    Found 0 dropped records,
    Found 0 comments,
    Found 0 blank records,
    Found 0 corrupted records,
    Found 0 old records,
    Found 5 new qualified records.
    ```

## Configuring Apache for AwStats

Copy the content of the `cgi-bin` folder to the default document root directory of your Apache installation. By default, this is in the `/usr/lib/cgi-bin` folder.

```
cp -r /usr/lib/cgi-bin /var/www/html/
chown www-data:www-data /var/www/html/cgi-bin/
chmod -R 755 /var/www/html/cgi-bin/
```

## Testing AwStats

Now you can access your AwStats by visiting the following URL: `http://your-server-ip/cgi-bin/awstats.pl?config=test.com`, which displays:

<Lightbox image={image} alt="" />

## Setting up a cron job to update logs

It is recommended to schedule a cron job to regularly update the AwStats database using newly created log entries, so the stats get updated regularly.

1. Edit the `/etc/crontab` file.
    ```
    nano /etc/crontab
    ```
2. Add the following line to tell AwStats to update every ten minutes:
    ```
    */10 * * * * root /usr/lib/cgi-bin/awstats.pl -config=test.com -update
    ```
3. Type `CTRL + O` and `CTRL + X` to save and exit.