简体   繁体   中英

nginx custom 404 error page not working

my nginx file is as follows. I am trying to redirect all 404 requests to to my index.html. There on the client side I have custom client side routing logic that will handle the URL.

But the default nginx 404 page is still getting called. (example: go to http://branches-app.com/Languages/Spanish ).

http {
   .......
    server {
            listen [::];
            listen 0.0.0.0;
            proxy_intercept_errors on;
            error_page 404 /index.html;
            location = /index.html {
                    root /var/www/html;
                    allow all;
            }

    }

}

What am I doing wrong?

Figured it out! I had an include directive including another conf file that had a server directive that was overriding that in the file i posted above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM