Convert Nginx Conf to use different roots for each location

I'm trying to modify my Nginx configuration so that the slots / tablet & / mobile are served from their own root.

I think I need to add alias definitions to my sites, but I'm not quite sure of the details.

server {
listen 80 default_server;
# listening [::]: 80 default_server ipv6only = on;

root / var / www / htdocs;
index.php index.html index.htm;

server_name localhost;

location / mobile {
if (! -e $ request_filename) {
rewrite ^ / mobile /(.*)$ /mobile/index.php?$args last;
}
}

location / tablet {
if (! -e $ request_filename) {
rewrite ^ / tablet /(.*)$ /tablet/index.php?$args last;
}
}

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

location ~  .php $ {
try_files $ uri = 404;
fastcgi_split_path_info ^ (. + . php) (/.+) $;
fastcgi_pass phpfpm: 9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_scriptname;
include fastcgi_params;
}
}
server {
listen to 80;
server_name www.domain.com domain.com docker.domain.com;

root / var / www / htdocs;
index.php index.html index.htm;

if ($ http_x_forwarded_proto! = & # 39; https & nbsp;) {
return 301 https: // $ servername $ request_uri;
}

location / mobile {
if (! -e $ request_filename) {
rewrite ^ / mobile /(.*)$ /mobile/index.php?$args last;
}
}

location / tablet {
if (! -e $ request_filename) {
rewrite ^ / tablet /(.*)$ /tablet/index.php?$args last;
}
}

location ~  .php $ {
try_files $ uri = 404;
fastcgi_split_path_info ^ (. + . php) (/.+) $;
fastcgi_pass phpfpm: 9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_scriptname;
include fastcgi_params;
}

location / {
if ($ http_x_forwarded_proto! = & # 39; https & nbsp;) {
return 301 https: // $ servername $ request_uri;
}
try_files $ uri $ uri / /index.php?$args;
}
}