Apr 122016

Hello again! NGINX 1.9.14 is now available in Ubuntu Xenial. There’s quite a few things we should make known to everyone who uses nginx in Ubuntu, with php5-fpm currently!

HTTP/2 is now enabled

Yes, HTTP/2 is now enabled for nginx-core, nginx-full, and nginx-extras in Ubuntu Xenial. Add http2 to your SSL listener line in your server blocks, and HTTP/2 will be enabled for that port and site.

For HTTP/2 on non-Xenial Ubuntu releases, you can use the Mainline PPA for Wily and later. Anything before Wily does not have full HTTP/2 support, and very likely will not be usable to get HTTP/2 working as intended.

Ubuntu Xenial ships php7.0-fpm, and not php5-fpm, and this will break existing site configurations

The Ubuntu Xenial packages for nginx have already been updated for this change, pointing to php7.0-fpm instead of php5-fpm.

However, users who have existing site configurations will not benefit from these changes. They must manually apply the changes.

Effectively, this is what a default setup uses to interface with the default php5-fpm setup on Ubuntu versions before Xenial, passing all PHP processing to the php5-fpm backend. This is from the default configuration file, but it’s still similar for all PHP passing:

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        # With php5-cgi alone:
        # With php5-fpm:
        fastcgi_pass unix:/var/run/php5-fpm.sock;

In Ubuntu Xenial, the TCP listener for php7.0-cgi will be unchanged, however for php7.0-fpm, it will be necessary to update the configuration to look like this for existing site configurations:

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        # With php7.0-cgi alone:
        # With php7.0-fpm:
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;

This will prevent HTTP 502 Bad Gateway errors, and will use the updated php7.0-fpm instead of the php5-fpm packages.

(If for some reason you still want to have php5-fpm under Xenial, you will not be able to get support from Ubuntu for this; you will need to use a PPA. I explain this on a different post on my blog.)

  4 Responses to “Ubuntu Xenial: NGINX and PHP7.0”

  1. Hello;

    So by default Ubuntu 16.04 comes with php7+nginx 1.9.14? any idea which is the default DB? mysql or mariadb?

    • I don’t track the ‘default database’ side of things, only NGINX and PHP which are things that I have to pay attention to.

      Funny thing is, though, nginx 1.9.15 landed today, last minute, so there’s 1.9.15 in Ubuntu Xenial; we have an SRU (Stable Release Update) planned for when 1.10.0 Stable is released by Nginx though.

  2. Is it just my machine, or are your instructions slightly wrong? Here the socket is in /var/run/php/php7.0-fpm.sock (note the extra /php/ segment).

    • Yay, I get to tell someone else in the Server Team to tell me things in the future. They gave me the wrong path, or rather they changed the socket run location since I touched base with them. This means I have to update all the default configs in Ubuntu and in the PPAs! FUN! (Post updated)

Sorry, the comment form is closed at this time.