Nginx angular fallback route

Whenever you navigate to a route that nginx can’t resolve you’ll see a 404 not found. To allow angular to handle the routing simply add the location section, so it redirects back to our index.html

server {
listen 80;
server_name example.org;
root /var/www/example.org/;
location / {
try_files $uri $uri/ /index.html;
}

}

Reload your nginx config:

nginx -s reload

That’s all, Enjoy!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store