Hello BartRo,
you can use this example found on gist.github.com to create a file mobile.conf in /etc/nginx/conf.d :
Then you will just have to edit the following line in /etc/nginx/conf.d/fastcgi.conf by replacing :
fastcgi_cache_key "$scheme$request_method$host$request_uri";
with
fastcgi_cache_key "$scheme$request_method$host$request_uri$is_desktop";
Then test your configuration with nginx -t and reload nginx with service nginx reload.