title: Can Nginx forward different paths to different sites?
body: <p>I want to configure Nginx to achieve:</p>
  <p>visit http://localhost:8222/a/ -&gt; Actual visit http://localhost:3000/;</p>
  <p>visit http://localhost:8222/b/ -&gt; Actual visit http://localhost:3001/;</p>
  <p><a href="http://127.0.0.1:3000/" rel="nofollow noreferrer">http://127.0.0.1:3000/</a> and <a href="http://127.0.0.1:3001/" rel="nofollow noreferrer">http://127.0.0.1:3001/</a> is a web pages！</p>
  <p>when visit 127.0.0.1:8222/a/ or 127.0.0.1:8222/a/. just fetch their HTML file.</p>
  <pre><code> location ~ .*\.(js|css)?${}
  </code></pre>
  <p>This can solve the file path. but how config the another.</p>
  <p>So can Nginx achieve this function or other better methods?</p>
  <pre><code>#user  nobody;
  worker_processes  1;
  
  #error_log  logs/error.log;
  #error_log  logs/error.log  notice;
  #error_log  logs/error.log  info;
  
  #pid        logs/nginx.pid;
  
  
  events {
      worker_connections  1024;
  }
  
  
  http {
      include mime.types;
      default_type  application/octet-stream;
  
      #log_format  main  '$remote_addr - $remote_user [$time_local] &quot;$request&quot; '
      #                  '$status $body_bytes_sent &quot;$http_referer&quot; '
      #                  '&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;';
  
      #access_log  logs/access.log  main;
  
      sendfile        on;
      #tcp_nopush     on;
  
      #keepalive_timeout  0;
      keepalive_timeout  100;
  
      #gzip  on;
  
      server {
          listen       8222;
          server_name  localhost;
  
          location /b/ {
            try_files $uri $uri/ /index.html last;
            proxy_pass http://127.0.0.1:3000/;
          }
  
          location /a/ {
            try_files $uri $uri/ /index.html last;
            proxy_pass http://127.0.0.1:3001/;
          }
  
          error_page   500 502 503 504  /50x.html;
          location = /50x.html {
              root   html;
          }
      }
  }
  </code></pre>