This took forever for me to figure out, so I'm doing you a solid to ensure you don't spend as much time as I did.
I assume you have php7.1 installed already, the only ish is the -fpm
Run sudo apt-cache search php7.1
This will show you a lot of related packages you can grab
Now run sudo apt-get install php7.1-fpm
And you're saved!