Answers for "Deploy single page application Angular: 404 Not Found nginx"

0

Deploy single page application Angular: 404 Not Found nginx

# for those not using a Staticfile might wanna try this.

# I had the same problem with nginx serving angular. The following is the default config file, probably found somewhere in /etc/nginx/sites-available/yoursite

     location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
    }
# but what we acctually want is...

     location / {
            # First attempt to serve request as file, then
            # as directory, then redirect to index(angular) if no file found.
            try_files $uri $uri/ /index.html;
    }
Posted by: Guest on September-20-2021
0

Deploy single page application Angular: 404 Not Found nginx

# for those not using a Staticfile might wanna try this.

# I had the same problem with nginx serving angular. The following is the default config file, probably found somewhere in /etc/nginx/sites-available/yoursite

     location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
    }
# but what we acctually want is...

     location / {
            # First attempt to serve request as file, then
            # as directory, then redirect to index(angular) if no file found.
            try_files $uri $uri/ /index.html;
    }
Posted by: Guest on September-20-2021

Code answers related to "Deploy single page application Angular: 404 Not Found nginx"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language