For adding multiple sites on nginx server you should utilize Nginx Server Blocks (Virtual Hosts)
. More about Nginx Server Blocks you can read in this DigitalOcean tutorial.
The main idea is to have one VH to point on php-5, while another will point to php-7.
This could be done by setting correct php path under ~.php$ location in Server Block config file.
Taken from Ubuntu 14.04 LEMP tutorial your php config should be something like…
/etc/nginx/sites-available/php5.com
...
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
...
For php-7 we will reefer to Ubuntu 16.04 LEMP tutorial, here it should look like
/etc/nginx/sites-available/php7.com
...
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
...
For full guide reefer to links I given you, they’re pretty good-written tutorials. :)
I hope this will fix problem

by Justin Ellingwood
A LEMP stack (Linux, Nginx, MySQL, and PHP) is a powerful set of software that can be configured to serve dynamic sites and web apps from your server. In this guide, we will discuss how to install a LEMP stack on an Ubuntu 14.04 server.