What web analytics package do you recommend as an alternative to Google Analytics? I see there is a tutorial on piwik, but it is 4 years old and out of date. Specifically, I need something that will work with nginx on Ubuntu (my site is running Node). Any chance you’d create a tutorial?
What do you use to track web traffic on your site?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Awesome, you’re 90% there already :-).
Essentially, what we’d do is create a similar server block and modify it to work with PHP-FPM. I’ll use
stats.domain.comin this example, but you’re free to modify it.
First thing you want to do is install your PHP packages. Since you’re using Ubuntu, that can be done using
I generally install most all available packages, so the initial install command would be:
That’ll handle pretty much everything, including what’s required by PiWik.
With PHP-FPM installed, now we need to focus on the server block itself. Since we should be using SSL, I’ll be setting up a near identical server block as what you’re already using and modifying it for PHP.
I recommend wiping
fastcgi_paramsand adding the configuration below. To do that, we can run:
Now copy and paste the following to that file:
Now you’d create a MySQL database and user for PiWik and extract the PiWik files to the directory you’ve defined. I used
/var/www/html/statsbut you could use anything.
Once the files are uploaded, you need to set their ownership to
www-data. To do that, we can run:
That’ll only change permissions on
statsand all files and directories within it, it’ll leave
/var/www/htmlalone (which is what we want).
Now, once you’ve setup an SSL certificate for the sub-domain and created the proper A and CNAME entries to make sure it points to your installation, all you need to do is restart NGINX and load the sub-domain to get the installer started.
If you run in to any errors, check the error log:
You can post any errors as a reply and I’ll do my best to help you troubleshoot them.
That said, I would recommend changing your second server block and swapping:
so that it matches your first block. That’ll work for NGINX when there’s only one server block, but it can potentially cause issues when you start adding multiple domains, sub-domains, etc.
Always make sure your Port 80 server blocks match your Port 443 server blocks. It’ll save you a ton of troubleshooting down the road.
You may want to check Countly, which is installable on-premises and available as a hosted platform. You have two options to deploy:
You can use Countly to track both web pages and mobile apps, as well as desktop apps.
Want to learn more? Join the DigitalOcean Community!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Sign up now
This comment has been deleted