我想将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';
}但是当我去localhost/oracle/index.html的时候,我得到了404。为什么会这样呢?
发布于 2017-09-28 06:29:44
您应该使用一个有效的regex,以~作为location块的前缀。
问题:
1.
Access-Controll-Allow-Origin应更正为Access-Control-Allow-Origin,拼写正确。 2.\/oracle\/(.+)Regex应予以更正。
注:
正则表达式使用前面的
~*(case-insensitive)和~(case-sensitive)指定。
将此更改为:
location /oracle/(.+) {
这里:
location ~\/oracle\/(.+) {
你可以看看nginx位置参考
https://stackoverflow.com/questions/46462328
复制相似问题