为什么我得到这个 nginx 反向代理的 404?

Why I am getting 404 for this nginx reverse proxy?

我想将 nginx 设置为反向代理,这是我当前的配置

location /oracle/(.+) {
    proxy_set_header Host $proxy_host;
    proxy_set_header Access-Controll-Allow-Origin *;

    proxy_pass  https://www.oracle.com/;
    proxy_hide_header 'x-frame-options';
    proxy_hide_header 'access-controll-allow-origin';

}

但是当我转到 localhost/oracle/index.html 时,我收到了 404。这是为什么?

您应该使用有效的 regex~ 作为 location 块的前缀。

问题:

1. Access-Controll-Allow-Origin should be corrected to Access-Control-Allow-Origin with correct spelling.

2. \/oracle\/(.+) Regex should be corrected to this.

注:

Regular expressions are specified with the preceding ~* for case-insensitive and ~ for case-sensitive

将此更改为:

location /oracle/(.+) {

这个:

location ~\/oracle\/(.+) {

你可以看看nginx location reference