title: Nginx reverse proxy return 404
body: <p>My Nginx installed and running, below is the config from <code>/etc/nginx/nginx.conf</code> , I want to forward all <code>/api/*</code> to my tomcat server, which is running on the same server at port 9100(type <code>http://myhost:9100/api/apps</code> works) , otherwise, serve static file under '/usr/share/nginx/html'. Now I type <code>http://myhost/api/apps</code> give an 404. What's the problem here?</p>
  
  <pre><code>upstream  myserver {
      server   localhost:9100 weight=1;
  }
  
  server {
      listen       80 default_server;
      listen       [::]:80 default_server;
      server_name  _;
      root         /usr/share/nginx/html;
  
      # Load configuration files for the default server block.
      include /etc/nginx/default.d/*.conf;
  
  
  
      location ^~ /api/ {
         proxy_pass http://myserver/;
      }
  
      location / {
      }
  }
  </code></pre>