title: How to redirect nginx request to different path
body: <p>Here is my <strong><em>nginx.conf</em></strong> which serves any request coming to <code>example.com</code> with <code>/srv/phabricator/phabricator/webroot/index.php</code>. I want to change the functionality such that if a request comes in to <code>example.com/test</code> then <code>/home/phragile/public/index.php</code> is served. </p>
  
  <pre><code>daemon off;
  error_log stderr info;
  worker_processes  1;
  pid        /run/nginx.pid;
  
  events {
      worker_connections  4096;
      use epoll;
  }
  
  http {
      include       /etc/nginx/mime.types;
      default_type  application/octet-stream;
      sendfile        on;
      keepalive_timeout  65;
      gzip  on;
      client_max_body_size  200M;
      client_body_buffer_size 200M;
  
      map $http_upgrade $connection_upgrade {
          default upgrade;
          '' close;
      }
  
      upstream websocket_pool {
          ip_hash;
          server 127.0.0.1:22280;
      }
  
      server {
          listen       *:80;
  
          access_log /var/log/nginx/access.log;
          error_log /var/log/nginx/error.log;
  
          root /srv/phabricator/phabricator/webroot;
          try_files $uri $uri/ /index.php;
  
          location /.well-known/ {
              root /srv/letsencrypt-webroot;
          }
  
          location / {
              index index.php;
  
              if ( !-f $request_filename )
              {
                  rewrite ^/(.*)$ /index.php?__path__=/$1 last;
                  break;
              }
          }
  
          location /index.php {
              include /app/fastcgi.conf;
              fastcgi_param PATH "/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin";
              fastcgi_pass 127.0.0.1:9000;
          }
  
          location = /ws/ {
              proxy_pass http://websocket_pool;
              proxy_http_version 1.1;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection "upgrade";
              proxy_read_timeout 999999999;
          }
      }
  }
  </code></pre>
  
  <p>I have tried the following but it does not work:</p>
  
  <pre><code>location /test {
       root /home/phragile/public;
  }
  </code></pre>
  
  <p>Can someone show me what needs to be added in the .conf file?</p>