「Matomo」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(英語版より転載)
 
(カテゴリを修正)
 
(同じ利用者による、間の4版が非表示)
1行目: 1行目:
[[Category:Web アプリケーション]]
+
[[Category:ウェブアプリケーション]]
 
[[en:Matomo]]
 
[[en:Matomo]]
 
[[zh-hans:Matomo]]
 
[[zh-hans:Matomo]]
  +
Matomo(旧 Piwik)は、GNU General Public License 3 でライセンスされたオープンソースのウェブ解析ツールです。このソフトウェアは PHP で書かれており、ウェブブラウザを介してアクセスします。プロジェクトの主要なアイデアはプライバシーであり、サードパーティのウェブサイト解析プロバイダを使用する場合、ウェブサイトのオーナーは、すべてのユーザーデータを広告主に売るために彼らに渡しています。
Matomo, formerly Piwik, is an open source web analysis tool licensed under the GNU General Public License 3. The software is written in php and is accessed over the web browser. The core idea of the project is privacy as when using third party website analysis providers website owners are giving all of their users' data away for them to sell them to advertisers.
 
   
  +
1 つの実行インスタンスで、対象ウェブサイトに JavaScript を読み込むことにより、複数のウェブサイトを解析することができます。
With one running instance multiple websites can be analysed by loading some JavaScript on the target websites.
 
   
== Installation ==
+
== インストール ==
   
  +
{{AUR|matomo}} または {{AUR|matomo-git}} パッケージを[[インストール]]します。git パッケージは、php-fpm デーモンを自動的に設定します。さらに、最新の GeoIP データベースをダウンロードしてインストールします。デフォルトでは、Matomo は訪問者の位置を設定されたブラウザ言語から推測しますが、これは地理的位置に対する信頼性のある情報ではありません。
[[Install]] the package {{AUR|matomo}} or {{AUR|matomo-git}}. The git package already configures the php-fpm daemon for you. Additionally, it downloads and installs the most recent GeoIP database for you. By default, Matomo guesses the visitor's location by their set browser language which is not reliable information for geographical location.
 
   
== Configuration ==
+
== 設定 ==
   
=== php configuration ===
+
=== php 設定 ===
   
  +
Matomo を動作させるためには、php を適切に設定する必要があります。
php needs to be configured properly for Matomo to work.
 
   
First, enable MySQL support as described in [[PHP#MySQL/MariaDB]]. Do so by editing {{ic|/etc/php/php.ini}}. Uncomment {{ic|1=;extension=pdo_mysql}} and {{ic|1=;extension=mysqli}} by removing the preceding semicolon.
+
まず、[[PHP#MySQL/MariaDB]] で説明されているように、MySQL サポートを有効にしてください。{{ic|/etc/php/php.ini}} を編集して、{{ic|1=;extension=pdo_mysql}} {{ic|1=;extension=mysqli}} の前のセミコロンを削除してコメントアウトを解除します。
   
  +
一般的に、コメントは先行するセミコロンで示されます。
In general, comments are indicated by preceding semicolons.
 
   
{{ic|1=;extension=iconv}} needs to be enabled and {{ic|1=;extension=gd}} is optional for Matomo. Uncomment at least iconv.
+
{{ic|1=;extension=iconv}} を有効にし、{{ic|1=;extension=gd}} Matomo にとってオプションです。少なくとも iconv のコメントアウトを解除してください。
   
==== Allow Matomo access to needed files ====
+
==== Matomo に必要なファイルへのアクセスを許可する ====
   
{{Note|The changes here are only needed for the {{AUR|matomo}} package and not {{AUR|matomo-git}} which already contains this file.}}
+
{{Note|ここでの変更は {{AUR|matomo}} パッケージにのみ必要で、すでにこのファイルを含む {{AUR|matomo-git}} には必要ありません。}}
   
  +
バージョン7.4 以降の {{ic|php-fpm.service}} に新たな制限があるため、{{ic|ProtectSystem}} が設定されていて Matomo が正しく機能しない(プラグインのインストール、設定の変更などができない)場合、特定のファイルへのアクセス権を手動で設定する必要があります。
Because of new restrictions on {{ic|php-fpm.service}} since version 7.4, where {{ic|ProtectSystem}} is set to prevent Matomo to function correctly (unable to installing plugins, changing configuration, etc), the ability to access certain files needs to be set manually.
 
   
The file {{ic|/etc/systemd/system/php-fpm.service.d/override_matomo.conf}} below fixes the issue while not exposing more than necessary and still allow the user to change ACL as described in the installation manifest, if this is not desired.
+
以下の {{ic|/etc/systemd/system/php-fpm.service.d/override_matomo.conf}} ファイルは、必要以上のものを公開せず、インストールマニフェストで説明されているようにACLを変更できるようにしたまま、問題を解決します。
   
 
{{bc|1=<nowiki/>
 
{{bc|1=<nowiki/>
38行目: 38行目:
 
}}
 
}}
   
=== Server setup (nginx) ===
+
=== サーバーの設定 (nginx) ===
   
  +
PHP のウェブサイトを有効にするには、{{Pkg|php-fpm}} パッケージをインストールし、{{ic|php-fpm.service}} を[[起動/有効化]]してください([[Nginx#PHP implementation]] を参照)。{{ic|/etc/nginx/nginx.conf}} を変更してサーバーを作成します。次のテンプレートを "http" コンテキストに追加してください。または、[https://github.com/matomo-org/matomo-nginx matomo's GitHub] の指示を参照してください。
In order to enable php websites, install the {{Pkg|php-fpm}} package and [[start/enable]] {{ic|php-fpm.service}} (See [[Nginx#PHP implementation]]).
 
Create the server by modifying {{ic|/etc/nginx/nginx.conf}}. Add the following template to the "http" context. Alternatively, take a look at [https://github.com/matomo-org/matomo-nginx matomo's GitHub] instructions.
 
   
 
{{bc|1=<nowiki/>
 
{{bc|1=<nowiki/>
81行目: 80行目:
 
}}
 
}}
   
  +
暗号化を使用する場合は、[[certbot|letsencrypt]] からフリーの証明書を取得できます。証明書を取得しインストールした後、以下のコードを "http" または "server" コンテキストに追加して使用します。
To use encryption, you can get free certificates from [[letsencrypt]]. After requesting and installing your certificates, use them by adding the following code to the "http" or "server" context:
 
   
 
{{bc|
 
{{bc|
90行目: 89行目:
 
}}
 
}}
   
Run the nginx server by [[starting/enabling]] {{ic|nginx.service}}.
+
nginx サーバーを実行するには、{{ic|nginx.service}} を[[起動/有効化]]してください。
   
{{Note|{{ic|mariadb.service}} and {{ic|php-fpm.service}} are required.}}
+
{{Note|{{ic|mariadb.service}} {{ic|php-fpm.service}} が必要です。}}
   
=== Final steps ===
+
=== 最終手順 ===
   
  +
主要な設定が完了しました。ブラウザで Matomo のウェブサイトにアクセスし、必要なものがすべて利用可能で設定されていることを確認し、設定ファイルを作成するだけの簡単なインストールガイドを完了してください。
All major settings are done. Call your Matomo website in your browser and complete the small installation guide which is not more than checking that everything needed is available and set up and writing your configuration file.
 

2023年4月12日 (水) 16:49時点における最新版

Matomo(旧 Piwik)は、GNU General Public License 3 でライセンスされたオープンソースのウェブ解析ツールです。このソフトウェアは PHP で書かれており、ウェブブラウザを介してアクセスします。プロジェクトの主要なアイデアはプライバシーであり、サードパーティのウェブサイト解析プロバイダを使用する場合、ウェブサイトのオーナーは、すべてのユーザーデータを広告主に売るために彼らに渡しています。

1 つの実行インスタンスで、対象ウェブサイトに JavaScript を読み込むことにより、複数のウェブサイトを解析することができます。

インストール

matomoAUR または matomo-gitAUR パッケージをインストールします。git パッケージは、php-fpm デーモンを自動的に設定します。さらに、最新の GeoIP データベースをダウンロードしてインストールします。デフォルトでは、Matomo は訪問者の位置を設定されたブラウザ言語から推測しますが、これは地理的位置に対する信頼性のある情報ではありません。

設定

php 設定

Matomo を動作させるためには、php を適切に設定する必要があります。

まず、PHP#MySQL/MariaDB で説明されているように、MySQL サポートを有効にしてください。/etc/php/php.ini を編集して、;extension=pdo_mysql;extension=mysqli の前のセミコロンを削除してコメントアウトを解除します。

一般的に、コメントは先行するセミコロンで示されます。

;extension=iconv を有効にし、;extension=gd は Matomo にとってオプションです。少なくとも iconv のコメントアウトを解除してください。

Matomo に必要なファイルへのアクセスを許可する

ノート: ここでの変更は matomoAUR パッケージにのみ必要で、すでにこのファイルを含む matomo-gitAUR には必要ありません。

バージョン7.4 以降の php-fpm.service に新たな制限があるため、ProtectSystem が設定されていて Matomo が正しく機能しない(プラグインのインストール、設定の変更などができない)場合、特定のファイルへのアクセス権を手動で設定する必要があります。

以下の /etc/systemd/system/php-fpm.service.d/override_matomo.conf ファイルは、必要以上のものを公開せず、インストールマニフェストで説明されているようにACLを変更できるようにしたまま、問題を解決します。

[Service]
ReadWritePaths = /usr/share/webapps/matomo/config
ReadWritePaths = /usr/share/webapps/matomo/matomo.js
ReadWritePaths = /usr/share/webapps/matomo/misc/user/
ReadWritePaths = /usr/share/webapps/matomo/plugins/

サーバーの設定 (nginx)

PHP のウェブサイトを有効にするには、php-fpm パッケージをインストールし、php-fpm.service起動/有効化してください(Nginx#PHP implementation を参照)。/etc/nginx/nginx.conf を変更してサーバーを作成します。次のテンプレートを "http" コンテキストに追加してください。または、matomo's GitHub の指示を参照してください。

include /etc/nginx/mime.types;

server
{
    index index.php;
    listen 443 ssl;
    listen [::]:443 ssl;
    root /usr/share/webapps/matomo/;
    server_name matomo.example.com;

    location ~ ^/(\.git/|config/|core/|lang/|tmp/)
    {
        return 403;
    }

    location ~ \.php$
    {
        try_files $uri =404;

        # FastCGI
        include fastcgi.conf;
        fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
    }

    location ~ \.(avi|css|eot|gif|htm|html|ico|jpg|js|json|mp3|mp4|ogg|png|svg|ttf|wav|woff|woff2)$
    {
        try_files $uri =404;
    }

    location ~ ^/(libs/|misc/|node_modules/|plugins/|vendor/)
    {
        return 403;
    }
}

暗号化を使用する場合は、letsencrypt からフリーの証明書を取得できます。証明書を取得しインストールした後、以下のコードを "http" または "server" コンテキストに追加して使用します。

include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
ssl_certificate_key /etc/letsencrypt/live/subdomain.domain.me/privkey.pem;
ssl_certificate /etc/letsencrypt/live/subdomain.domain.me/fullchain.pem;

nginx サーバーを実行するには、nginx.service起動/有効化してください。

ノート: mariadb.servicephp-fpm.service が必要です。

最終手順

主要な設定が完了しました。ブラウザで Matomo のウェブサイトにアクセスし、必要なものがすべて利用可能で設定されていることを確認し、設定ファイルを作成するだけの簡単なインストールガイドを完了してください。