Sakshi Gupta
Sakshi Gupta

Reputation: 1

On Reload Angular7 application getting 404 after deployment

Removed # from the URL before using "{provide: LocationStrategy, useClass: HashLocationStrategy}" this in appModule file After Removing this getting 404 and

https://example.com/dashboard//home in logs i saw one extra '/' is getting added from NGINX

After NGINX Changes

 location / {
    alias /usr/share/nginx/html/;
         try_files $uri $uri/ /index.html;
          try_files $uri $uri/ = 404;
            try_files $uri $uri/ /index.html =404;
  }

tried these below 2 solution

Angular 2 Hosted on IIS: HTTP Error 404

Angular deployment - 404 on page Refresh

Upvotes: 0

Views: 109

Answers (1)

Sakshi Gupta
Sakshi Gupta

Reputation: 1

location / {
    include /etc/nginx/mime.types;
    try_files $uri /index.html =404;
}

added this to NGINX and worked for me

Thanks :)

Upvotes: 0

Related Questions