Web Served, the finale: Congratulations, you have a Web server! And after?

Aurich Lawson/Thinkstock

Welcome, dear readers, to the final piece in our long “Web Served” series. Since last November, Ars has been helping shed some light on the fun world of DIY web hosting – we started by setting up Nginx on Ubuntu, and progressed to hosting advanced applications with PHP and even Node.js .

Along the way, we struggled with the command line and probably cursed typos in configuration files. We have felt the incredible triumph of a simple “success” log file message and the crushing defeat of an error that seems to occur for no reason. If you’ve stuck with us for the entire article delivery, you’ve got a full-featured web server capable of serving pages securely and quickly and running a wide range of awesome applications. Congratulations are in order – good job!

At this point, you have a working Nginx web server configured with speed and security in mind. You have it configured with SSL/TLS, have (maybe) official certificates and can serve encrypted data. You have configured PHP with MySQL-compatible MariaDB database, so you can manage the most popular web applications. Speaking of apps, you probably also have a WordPress blog, Vanilla forum, and maybe even your own MediaWiki wiki.

But there is so much more there beyond simple PHP applications! We opened that door a bit in Web Served 8, where we configured Node.js and Redis to get Etherpad up and running. It’s just one of many non-PHP web applications. If you’re like me, setting it all up gets you excited for the following great thing you can do with the server: setting up a new web application and seeing it work fine is addictive. What other can you play with it beyond forums and wikis? What cool new things can we do?

Hang on. We’re going to hit a whole bunch of stuff. This time, rather than explaining the details to you, you will be on your own for the detailed setup instructions. Don’t worry, if you’ve made it this far, you can go a little further. You’re ready.

Tables, graphs and statistics

We’ve put a lot of things in place over the last eight articles, but we haven’t focused much on the monitoring and reporting side of things. It’s one thing to have your web server happily spitting out pages to everyone who visits, but how do you know who’s actually visiting?

Modern web analytics is a highly refined science, and there are tons of providers that will help you find out who your visitors are and what they are looking at on your site. The most important analysis tool is the aptly named Google Analytics. It is both highly functional and free. You create an account, provide Google with basic information about your site, and receive tracking code, a snippet of JavaScript code that you embed into each of your website’s pages. When visitors browse your site, the code is downloaded by their browsers, and their own browsers report their actions to Google. Google then aggregates the data into nice tables and graphs.

Google’s offer is free and works great, but it has the obvious downside of not controlling your tracking results. You rely on Google to host the analytics service, and you also pass all of your data to Google for use (remember the old adage that if an internet service is free to you, you’re probably not not the actual customer of the service).

Piwik for self-hosted analytics

There are alternatives to Google Analytics, and in the DIY spirit of “Web Served”, I recommend downloading and setting up one of these alternatives, especially Piwik. Piwik is an open source analytics application that uses your server’s existing PHP and MySQL/MariaDB capabilities to provide a very similar experience to Google Analytics, with the huge advantage of leaving you in control of your data. All collected analytics stay on your own server in your own database.

The Piwik dashboard page for my blog.
Enlarge / The Piwik dashboard page for my blog.

Lee Hutchinson

Piwik has good documentation for self-hosted installation. It requires PHP and MySQL (or MariaDB, as we use it). It must have its own database configured, as most web applications require. It’s best to give it its own unique database credentials that only have privileges to its own database, like we’ve done for the other web apps we’ve set up in this series.

Once installed, Piwik will generate its own JavaScript tracking code that you can insert into your web pages, just like Google Analytics. It’s also a good idea to take a look at Piwik’s privacy options – Piwik includes the ability to honor a browser’s “Do Not Track” option as well as the ability to anonymize IP addresses users.

Piwik's geolocation feature shows you where your visitors are coming from.
Enlarge / Piwik’s geolocation feature shows you where your visitors are coming from.

Lee Hutchinson

Once you’re set up and running and have inserted your tracking code into your pages, you can sit back and watch the numbers start rolling in. Piwik will tell you what websites you get visitors from and what search engine queries lead visitors to your site (well, sort of: Google does not report search terms of reference on logged in Google account users, from so this feature quickly loses its usefulness). It can break down your traffic reports by time periods, pages, sources, or a number of other factors.

It also offers sophisticated traffic flow analysis functions, although they are not as complex and interactive as those available through Google Analytics.
Enlarge / It also offers sophisticated traffic flow analysis functions, although they are not as complex and interactive as those available through Google Analytics.

Lee Hutchinson