I'm a programmer specialising in performant and scalable systems using PHP and Ruby and cooking


Published:

Ubuntu 12.04 and broken Nginx 1.19

Ubuntu 12.04 currently has nginx 1.19 as it's latest packaged version, unfortunately this version is actually broken due to a seg fault caused by try_files (more details). This can be easily recognised by receiving empty responses and in your nginx error log you will see:

2012/06/06 18:09:33 [alert] 28243#0: worker process 29364 exited on signal 11 (core dumped)  

This is actually rather misleading but also very easy to fix.

Clearing the bore!

In order to install a fixed version of Nginx first the current version needs to be removed, don't worry this won't delete your configs:

$ apt-get autoremove nginx

Sealing the breach

Next step is to install an updated version of Nginx. There is no need to manually compile as some places tell you; there is a PPA provided which contains a fixed version (1.20) of nginx. The following will need to run as root:

$ nginx=stable 
$ echo "deb ppa.launchpad.net/nginx$nginx/ubuntu lucid main" > /etc/apt/sources.list.d/nginx-$nginx-lucid.list
$ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C
$ apt-get update 
$ apt-get install nginx

Now simply restart Nginx to fix the issue and use the newly installed binary, if you follow these steps you should alos experience 0 downtime (apart from the seg fault obviously)