Relocating application in nginx

I have my application running at the second level domain (say, example.com). Here is the file located in sites-enabled:

upstream unicorn {
  server unix:/tmp/unicorn.appname.sock fail_timeout=0;
}

server {
  server_name example.com, www.example.com;
  listen 00.000.000.000;
  root /home/deployer/apps/appname/current/public;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @unicorn;
  location @unicorn {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://unicorn;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 4G;
  keepalive_timeout 10;

}

It works fine.
Now I'd like to move application to admin.example.com/applicationname

Can I simply change server_name to admin.example.com/applicationname, or it should be accomplished in a different way?


Now I'd like to move application to admin.example.com/applicationname

For sake of clarity — From where?

Can I simply change server_name to admin.example.com/applicationname, or it should be accomplished in a different way?

You can, but it simply won't work — server name should contain only domain part of URI.

I can assume that what you're really asking about is moving application from "/" to "/subfolder", and in that case there's special part of documentation for you: «…

If proxy_pass is specified with URI, when passing a request to the server, part of a normalized request URI matching the location is replaced by a URI specified in the directive:

location /name/ {
proxy_pass http://127.0.0.1/remote/;
}

…»