404 Error on page refresh : Angular, NGINX

SOLUZIONI

Problema da risolvere:

Con una applicazione scritta in Angular e proxata  con NGINX, quando si aggiorna  la pagina nel browser (F5) si ottiene come risposta  una pagina di errore NGINX 404.

Soluzione:

Basta aggiungere nell’entry location nella configurazione di nginx per il site abilitato, la riga : try_files $uri $uri/ /index.html

server {
    listen       80;
    server_name  localhost;

    location / {
        root   /usr/share/nginx/html;
        try_files $uri $uri/ /index.html;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

}
Se vuoi farmi qualche richiesta o contattarmi per un aiuto riempi il seguente form

    0 0 votes
    Article Rating
    Subscribe
    Notificami
    guest
    0 Commenti
    Inline Feedbacks
    View all comments
    0
    Would love your thoughts, please comment.x