Home  >  Q&A  >  body text

Server Configuration - How does nginx proxy to a file?

Now there is a proxy server, and I want to access api.php in the root directory of the intranet web machine through proxy. How should I configure proxy forwarding?
I wrote it like this, but it didn’t seem to work. I added an api.html

to the root directory of the proxy server.

location ~ /api.html {
proxy_pass http://192.168.10.2:80/api.php;
}

Please give me some advice!

为情所困为情所困2735 days ago529

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-16 17:11:13

    Try
    rewrite api.html http://192.168.10.2:80/api.php permanent;

    reply
    0
  • Cancelreply