0

I am running 2 apps locally, one in AngularJS, and the other in Angular 10 using nginx web server. Both the apps are running as expected, but the issue is that when I refresh the Angular app it throws a 404 error. The Angular app works fine when refreshed. Below is the nginx config file:

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

        location /angular-js {
            expires    -1;
            alias /path/to/app/angular-js;
        }

        location /angular-10-app {
            expires -1;
            alias /path/to/app/dist/angular-10-app;
        }

        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

    }

}

I would like to route all URLs starting with "/angular-10-app" to go to the angular 10 app path. But not sure how I can add something like "/angular-10-app/*" in nginx.

Aiguo
  • 3,416
  • 7
  • 27
  • 52
  • Does this answer your question? [How to config nginx to run angular4 application](https://stackoverflow.com/questions/45277183/how-to-config-nginx-to-run-angular4-application) – The Fabio Mar 14 '22 at 21:14

0 Answers0