This is a small nginx configuration that should help you get your own Matomo instance running and start collecting your own analytics.
In this case it should be enough to just take the sites-available/matomo.conf
, check if everything is configured as you like it and enable the config.
/etc/nginx/
(or wherever you store your nginx-config)sites-available/matomo.conf
and modify the settings to fit your use case:
server_name
to the domain(s) of your Matomo instancessl.conf
according to your need. (the Mozilla SSL Config Generator will help you)/var/www/matomo/
with the path to your Matomo instancefastcgi_pass
to the path of your PHP socket filesites-enabled
folder of your nginx config directorysudo ln -s ../sites-available/matomo.conf
sudo nginx -t
sudo systemctl restart nginx
If you need to check the legacy nginx Matomo configuration, you can find it here: https://github.com/matomo-org/matomo-nginx/tree/1.0.99
ssl.conf
fileserver_tokens off;
to your config to disable the server: nginx
header on all requests and the nginx version on error pagesStrict-Transport-Security
header, but keep in mind the implicationsYou know how to improve this config? Open a pull request or GitHub issue!