Setting up an Ubuntu 14.04 LEMP Server with the Nightly Build of PHP7

Install nginx

apt-get update
apt-get install nginx

Install and secure MySQL

apt-get install mysql-server
mysql_install_db
mysql_secure_installation

Add Zend repo and install PHP7

echo "deb http://repos.zend.com/zend-server/early-access/php7/repos ubuntu/" >> /etc/apt/sources.list
apt-get update 
apt-get install php7-nightly

Configure PHP7 php-fpm.conf

cd /usr/local/php7/etc
cp php-fpm.conf.default php-fpm.conf
nano php-fpm.conf

Uncomment/Change

pid = /var/run/php7-fpm.pid

Uncomment/Change

error_log = /var/log/php-fpm.log

Configure PHP7 www.conf

cd /usr/local/php7/etc/php-fpm.d
cp www.conf.default www.conf
nano www.conf

Change

user = www-data

Change

group = www-data

Uncomment

listen.allowed_clients = 127.0.0.1

Uncomment

security.limit_extensions = .php .php3 .php4 .php5 .php7

Configure PHP7

wget -O /etc/init.d/php7-fpm "https://gist.github.com/bjornjohansen/bd1f0a39fd41c7dfeb3a/raw/f0312ec54d1be4a8f6f3e708e46ee34d44ef4657/etc%20inid.d%20php7-fpm"
chmod a+x /etc/init.d/php7-fpm
touch /etc/init/php7-fpm.conf
nano /etc/init/php7-fpm.conf

Add the following to php7-fpm.conf

exec /usr/local/php7/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php7/etc/php-fpm.conf

Add the checkconf file for PHP7

touch /usr/local/lib/php7-fpm-checkconf
    nano /usr/local/lib/php7-fpm-checkconf

Add the following to the php7-fpm-checkconf

#!/bin/sh
set -e
errors=$(/usr/local/php7/sbin/php-fpm --fpm-config /usr/local/php7/etc/php-fpm.conf -t 2>&1 | grep "\[ERROR\]" || $
if [ -n "$errors" ]; then
    echo "Please fix your configuration file..."
    echo $errors
    exit 1
fi
exit 0

Configure PHP7 continued

chmod a+x /usr/local/lib/php7-fpm-checkconf
update-rc.d -f php7-fpm defaults
ln -s /usr/local/php7/bin/php /usr/local/bin/php
ln -s /usr/local/php7/sbin/php-fpm /usr/sbin/php-fpm
service php7-fpm start

Set up nginx config

cd /etc/nginx/sites-available
cp default (your site here).conf
nano (your site here).conf

Configure your config as needed (example script below)

server {
        listen *:80;
        server_name (server name here);

        root /usr/share/nginx/html;
        index index.php index.html index.htm;

        client_max_body_size 1m;

        error_log /var/log/nginx/(your site here).error.log;
        access_log /var/log/nginx/(your site here).access.log;

        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
                fastcgi_index index.php;
                fastcgi_split_path_info ^(.+\.php)(/.*)$;
                try_files $uri $uri/ /index.php$is_args$args;
                fastcgi_pass 127.0.0.1:9000;
                include /etc/nginx/fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                fastcgi_param APP_ENV dev;
        }
}

Continue set up nginx

ln (your site here).conf ../sites-enabled/(your site here).conf
rm ../sites-enabled/default

Restart services

service php7-fpm restart
service nginx restart