[英]Why I am getting 404 for this nginx reverse proxy?
I want to set up nginx as a reverse proxy and this is my current config 我想将Nginx设置为反向代理,这是我当前的配置
location /oracle/(.+) {
proxy_set_header Host $proxy_host;
proxy_set_header Access-Controll-Allow-Origin *;
proxy_pass https://www.oracle.com/$1;
proxy_hide_header 'x-frame-options';
proxy_hide_header 'access-controll-allow-origin';
}
But when I goto localhost/oracle/index.html
I am getting a 404. Why is this? 但是当我转到localhost/oracle/index.html
我得到的是404。这是为什么?
You should use a valid regex
with ~
as prefix for location
block. 您应该使用带有~
的有效regex
作为location
块的前缀。
Problems: 问题:
1.
Access-Controll-Allow-Origin
should be corrected toAccess-Control-Allow-Origin
with correct spelling. 1.应使用正确的拼写将Access-Controll-Allow-Origin
纠正为Access-Control-Allow-Origin
。2.
\\/oracle\\/(.+)
Regex should be corrected to this. 2.\\/oracle\\/(.+)
/(。+\\/oracle\\/(.+)
表达式应对此进行更正。
Note: 注意:
Regular expressions are specified with the preceding
~*
forcase-insensitive
and~
forcase-sensitive
正则表达式在前面的~*
中指定case-insensitive
和~
(case-sensitive
Change this to: 更改为:
location /oracle/(.+) {
this: 这个:
location ~\\/oracle\\/(.+) {
You can have a look at nginx location reference 您可以看看nginx位置参考
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.