@overclockedllama wrote:
Hey there. I am trying to run matomo (apache server) in a docker container with nginx running on the host system. I would like to simply reverse proxy from nginx on the host to the docker container running matomo. Below is my docker-compose.yml and my nginx site file.
docker-compose.yml (I got it from here: docker/docker-compose.yml at master · matomo-org/docker · GitHub):
version: "3" services: db: image: mariadb command: --max-allowed-packet=64MB restart: always volumes: - ./db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=********* env_file: - ./db.env app: image: matomo restart: always volumes: #- ./config:/var/www/html/config #- ./logs:/var/www/html/logs - ./webroot:/var/www/html environment: - MATOMO_DATABASE_HOST=db - VIRTUAL_HOST= env_file: - ./db.env ports: - 2468:80
tracking.example.com nginx config:
server { error_page 404 /404.html; server_name tracking.example.com; location / { proxy_pass http://localhost:2468/; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/tracking.example.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/tracking.example.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = tracking.example.com) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; listen [::]:80; server_name tracking.example.com; return 404; # managed by Certbot }
The installation works fine, but I get this error when trying to log in:
Error : Form security failed. Please reload the form and check that your cookies are enabled. If you use a proxy server, you must configure Matomo to accept the proxy header matomo. org/faq/how-to-install/#faq_98 that forwards the Host header. Also, check that your Referrer header is sent correctly.Also, you may force Matomo to use a secure connection matomo .org/faq/how-to/faq_91/: in your config file config/config.ini.php set
My config.ini.php has been edited and now looks like this:
; <?php exit; ?> DO NOT REMOVE THIS LINE ; file automatically generated or modified by Matomo; you can manually override the default values in global.ini.php by redefining them in this file. [database] host = "db" username = "matomo" password = "*****************" dbname = "matomo" tables_prefix = "matomo_" [General] assume_secure_protocol = 1 salt = "*********************" trusted_hosts[] = "localhost" trusted_hosts[] = "example.com" ; Uncomment line below if you use a standard proxy proxy_client_headers[] = HTTP_X_FORWARDED_FOR proxy_host_headers[] = HTTP_X_FORWARDED_HOST ; Uncomment line below if you use CloudFlare ;proxy_client_headers[] = HTTP_CF_CONNECTING_IP ; Uncomment line below if you use another proxy (that sets Client-IP header) proxy_client_headers[] = HTTP_CLIENT_IP [PluginsInstalled] PluginsInstalled[] = "Diagnostics" PluginsInstalled[] = "Login" PluginsInstalled[] = "CoreAdminHome" etc... all the rest of the plugins
Posts: 1
Participants: 1