upstream fpm {
    server php-fpm:9000;
}

upstream fpm7.1 {
    server php7.1-fpm:9000;
}

map $http_host $root {
    loc.octobercms /usr/share/nginx/html/someproject;
    loc.wordpress /usr/share/nginx/html/someprojectwp;
}

server {
    server_name loc.octobercms;
    listen 80;
    root $root;
    #include global/auth.conf;
    #@see https://vcs.wpstudio.ru/wpstudio/nginx-examples
    include includes.d/octobercms.conf;
    include includes.d/staticfiles.conf;
    location ~ ^/index.php {
        fastcgi_pass fpm;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

server {
    server_name loc.wordpress;
    listen 80;
    root $root;
    index index.html index.htm index.php;
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
        access_log off;
    }
    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
          return 404;
        }
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

        fastcgi_pass   fpm;
        fastcgi_index  index.php;
    }
}