Nginx中proxy_pass不支持#

时间:2019-07-03 12:18:54

标签: linux nginx nginx-reverse-proxy nginx-config

我是nginx的新手,我试图创建干净的URL模式,如果在浏览器"http://xx.xx.xx.xx:61001/employee"上使用以下URL,则它将路由到"http://localhost:8080/emp/#/details"。但不幸的是,我在浏览器上收到404错误。即使我的应用程序已启动并正在运行。 #(特殊字符)在nginx中有问题。有人可以帮我吗?

在我的配置下面:

location /employee {proxy_pass http://localhost:8080/emp/#/details;
}

在浏览器上出现404错误

这是我的完整服务器配置:

server { 
  listen 8081;
  server_name xx.xx.xxx.xxx;
  location / { root html; index index.html index.htm; }
  location /employee { proxy_pass localhost:8080/emp/#/details; }
  error_page 500 502 503 504 /50x.html;
  location = /50x.html { root html; } 
}

1 个答案:

答案 0 :(得分:0)

现在您正在监听8081端口,将其更改为80。

server { 
  listen 80;
  server_name xx.xx.xxx.xxx;
  location / { root html; index index.html index.htm; }
  location /employee { proxy_pass localhost:8080/emp/#/details; }
  error_page 500 502 503 504 /50x.html;
  location = /50x.html { root html; } 
}