Understanding the Nginx Configuration Inheritance Model

The nginx configuration model is a big improvement over the Apache HTTPd one.

But when you dive in deeper there are some quirks to be aware of. Without knowledge of the fundamentals it’s easy to run into situations where you get unexpected behaviour.

To make sure you always know how to wrangle nginx I’ve prepared this post to help you understand how it all works, read on!

Continue Reading

Securing Nginx + PHP When Using Path Info

Remember register globals?

Remember how you had to code as if it was off, because it might be?

Remember how you had to consider the security implications of it being on, because it might be?

The might be and might not be is something which has plagued a lot of early PHP features.

Register globals is in no way alone in this, in the effort of making things versatile the PHP developers managed to introduce the worst of both worlds and the best of none.

Today I want to cover a very known feature, which many people often don’t think of as being in the same group as register globals.

Continue Reading

The Fun that is UTF-8 Support in PHP

Lately I’ve been working with a friend on a daily-deal aggregator. The Groupon-like sites are popping up everywhere and the market for aggregators is still fairly unfilled.

My project, Alladeals, target the Swedish daily deals market and as such it needs to support Swedish characters.

In future it might have to support other languages as well so I decided that UTF8 was the way to go.

Since most webpages are encoded in UTF-8 these days it has been fairly painless to actually work with UTF-8 in PHP, that is, until yesterday.

PHP does not natively support UTF-8. This is fairly important to keep in mind when dealing with UTF-8 encoded data in PHP. Usually I’m pretty good at remembering that, however yesterday I happened upon a bug which could easily have gone unnoticed for months if not for some random luck.

Continue Reading

Optimizing Nginx for High Traffic Loads

I have previously talked about some of the most common nginx questions.

Not surprisingly, one such question is how to optimize nginx for high performance.

This is not surprising as most new nginx users are migrating from Apache and thus are used to having to tune settings and perform voodoo magic to ensure their servers perform well.

So how do you tune and optimise nginx? Read on!

Continue Reading

Nginx Primer 2: From Apache to Nginx

Nginx, Technology
32 Comments

The Big Picture

So you’ve finally decided to make the switch from Apache to nginx.

You most likely did this for performance reasons; perhaps all those blogs have been writing about how fast nginx is.

Perhaps your webmaster friends have been raving about how they can now handle a lot more traffic without spending money on hardware.

Continue Reading