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

Aurich Lawson / Thinkstock

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

Along the way, we struggled with the command line and probably cursed the typos in the config 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 have stayed with us for all of the article distribution, you have a full web server capable of serving pages safely and quickly and running a wide range of awesome applications. Congratulations, good job!

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

But there is so much more 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. This is just one of many non-PHP web applications. If you’re like me, putting it all together just gets you excited about the Following great thing you can do with the server: setting up a new web application and seeing it run fine is addicting. What other can you play with it beyond forums and wikis? What cool new things can we do?

Buckle up. 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 in place in the last eight articles, but we haven’t focused much on tracking and reporting. It’s one thing that your web server happily spits out pages to everyone who visits, but how do you know who is actually visiting?

Modern web analytics is a highly refined science, and there are tons of providers out there that will help you understand 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’s both very functional and free. You create an account, give Google basic information about your site, and you receive a tracking code, a JavaScript snippet that you embed into every page of your website. When visitors browse your site, the code is downloaded by their browsers, and their own browsers report actions they take to Google. Google then aggregates the data into nice tables and charts.

Google’s offer is free and works great, but the obvious downside is that you don’t control 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 for you, you are not. probably not the real 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 configuring one of these alternatives, in particular, Piwik. Piwik is an open source analytics application that uses your server’s existing PHP and MySQL / MariaDB capabilities to deliver a very Google Analytics style experience, with the huge benefit of letting you be in control of your data. All collected analyzes remain 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 a self-hosted installation. This requires PHP and MySQL (or MariaDB, as we use it). It should have its own database configured, just as most web applications require. It’s best to give it its own unique database credentials that only have privileges on its own database, like we’ve done with the other web apps we’ve configured 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 users’ IP addresses.

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 put your tracking code into your pages, you can sit back and watch the numbers start rolling in. Piwik will tell you which websites you get visitors from and which search engine queries direct visitors to your site (well, somehow Google doesn’t report search terms on logged in Google account users, so this feature quickly loses its usefulness). It can break down your traffic reports by time periods, by pages, by sources, or by 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

Comments are closed.