matomo-org / matomo-org/docker

Matomo-Docker behind a Nginx Proxy

Open
#295 3 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
1k
Forks
384
PR merge metrics
No merged PRs in 30d

Description

For a configuration of Matomo and docker-compose being served by a Nginx server already in place and dealing with
SSL certificates and such you have to insert some additional config values:

In /var/www/html/config/config.ini.php in the matomo_app_1 container (or whatever name `docker-compose' has
rendered):

[General]
proxy_client_headers[] = HTTP_X_FORWARDED_FOR
proxy_host_headers[] = HTTP_X_FORWARDED_HOST
assume_secure_protocol = 1
force_ssl = 1
trusted_hosts[] = "localhost:<PORT>"
trusted_hosts[] = "<EXTERNAL_HOST>"

In your Nginx config there has to be a section like this:

...

location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Host $host;
    proxy_pass <PROXY_CONFIG>;
}
...

...where should be the externally visible port of your docker-compose.yml, <EXTERNAL_HOST> the externally visible hostname your Matomo instance is configured for in Nginx, and <PROXY_CONFIG> your proxy configuration,
e.g. http://localhost:8088.

I'm not sure if every entry is necessary, but this is a working configuration I found after a bit of trying, and perhaps it saves a bit of time for others.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by checking the repository's Docker Compose and reverse-proxy documentation locations; the issue names docker-compose.yml, the Matomo config.ini.php path, and an Nginx location block. Done looks like a documented, clearly scoped configuration for serving Matomo behind Nginx, with the required placeholders explained.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, nginx
Domain
devops, infrastructure
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.