Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoIP issue in matomo image #374

Open
abdulazizasiri opened this issue Dec 21, 2024 · 0 comments
Open

GeoIP issue in matomo image #374

abdulazizasiri opened this issue Dec 21, 2024 · 0 comments

Comments

@abdulazizasiri
Copy link

I have a problem.

I have 3 images.

1- Matomo:5.2.0

2- MariaDB:latest

3- Nginx:latest

This is the docker-compose:

`services:
matomoDb:
image: mariadb:latest
command: --max-allowed-packet=64MB
restart: always
ports:
- "3306:3306"
volumes:
- matomoDb:/var/lib/mysql:Z
env_file:
- db.env
networks:
- custom_network

matomo:
build:
context: .
dockerfile: Dockerfile
image: matomo-geoip:latest
restart: always
links:
- matomoDb
volumes:
- matomo:/var/www/html:z
networks:
- custom_network

matomoWeb:
image: nginx:latest
restart: always
volumes:
- matomo:/var/www/html:z,ro
- ./default.conf:/etc/nginx/conf.d/default.conf:z
ports:
- "8082:80"
networks:
- custom_network # Custom network for communication with other services

volumes:
matomoDb:
matomo:

networks:
custom_network:
driver: bridge`

This is default.conf

`
upstream backend {
server matomo:9000; # Ensure the port is specified here
}

server {
listen 80;
root /var/www/html/;
index index.php index.html index.htm;

# Forward the real client IP and other necessary headers
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;

location / {
    try_files $uri $uri/ =404;
}

location ~ \.php$ {
    fastcgi_pass backend;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    # Forward client IP and real IP
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
}

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

location = /50x.html {
    root /usr/share/nginx/html;
}

}
`

After I set matomo up in the admin page, I go to
Settings → System → Geolocation, then I download the GeoIP 2 database.

and then I choose the

DBIP - GeoIp 2 (php) and save

I get the wrong IP address when GeoIP resolves it. The IP I get is the container IP address.

How do I fix this?

Thank you all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant