0

I am trying to deploy my Angular-NodeJS project on a server, I used nginx for Angular part and PM2 for NodeJs part. When I try the server address http://95.216.132.229/ it works fine and redirects to the http://95.216.132.229/home, but when I refresh the page it gives 404 Not Found error! I haven't this problem when I try to run my project locally.

Why this happens and how can I fix it?

Hasani
  • 3,543
  • 14
  • 65
  • 125
  • keep this imports: [RouterModule.forRoot(routes, { useHash: true})] in app-routing.module.ts – Anil Kumar Reddy A Jul 14 '20 at 09:17
  • 1
    You have to configure nginx to redirect all Urls to the index.html, so angular can handle the routes. Check out this [entry](https://stackoverflow.com/questions/45858957/deploy-single-page-application-angular-404-not-found-nginx.). – riorudo Jul 14 '20 at 09:18

0 Answers0