Angular Nginx Docker 404 Angular Nginx Docker 404 nginx nginx

Angular Nginx Docker 404


Silly me, I was not overwriting the default docker conf in the docker file

COPY nginx.conf /etc/nginx/conf.d/default.conf


use { "useHash" : true } in AppRoutingModule.

imports: [RouterModule.forRoot(routes , {useHash : true } )]

When you put 34...**:8080/anyroute, nginx will search is that route available in his server, not in angular app. That's why the 404 error occurs.. using useHash true , it will automatically format your url with a hash.

34...**:8080/#/anyroute

nginx will not read after #It will redirected to your app