简体   繁体   English

网站未在第一次打开浏览器中的共享链接 angular 8 和 nginx

[英]website not opening in first time shared link in browser angular 8 and nginx

bhaskarhindi.com id an angualr8 front end and Nginx server hosted in AWS instance using nodejs Redis API call to fetch data. bhaskarhindi.com id an angualr8 front end and Nginx server hosted in AWS instance using nodejs Redis API call to fetch data. But after deploying and using hash the first time in the browser it is not opening showing 404 error.但是在第一次在浏览器中部署和使用 hash 后,它没有打开并显示 404 错误。 But after a hard refresh or multiple time click it's opeing.但是经过硬刷新或多次单击它正在运行。

Any solution i have tried index.html aot and hashed build but not working.我尝试过 index.html aot 和散列构建但不起作用的任何解决方案。

404 is shown by the server itself, when it tries to find the route you have passed in the URL (as the server doesn't have access to that route, but Angular has). 404 由服务器本身显示,当它试图找到您在 URL 中传递的路由时(因为服务器无权访问该路由,但 Angular 有)。

You need to make sure that the server redirects all the 404 requests to the index.html of the Angular application.您需要确保服务器将所有 404 请求重定向到 Angular 应用程序的 index.html。 Only then Angular can pick up and show the pages accordingly.只有这样 Angular 才能相应地拾取和显示页面。

Read through this: https://angular.io/guide/deployment#server-configuration for more information.阅读此内容: https://angular.io/guide/deployment#server-configuration了解更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM