【发布时间】:2021-07-27 12:50:40
【问题描述】:
我创建了一个 Angular 应用程序,它在 /hello 路由上显示带有“Hello World”的页面。
角度网址:http://localhost:4200/hello
我想在/greet => http://localhost/greet 上从浏览器向 Nginx 发出请求
并且应该重定向到 Angular 应用程序的/hello 路由,以便显示带有“Hello World”的页面。
但如果请求是http://localhost/hello,则应该出现错误
nginx 配置文件:
server {
listen 80;
server_name _;
location /greet {
proxy_pass http://localhost:4200/hello;
}
location /hello {
return 404;
}
}
问题是,在重定向时,路由没有被修改为/hello,并且由于角度中没有/greet 路由,我得到一个找不到。
【问题讨论】:
标签: nginx