[Vuejs]-404 nginx error on page reload with vuejs

0๐Ÿ‘

I solved the problem using following solution of maximkrouk from https://github.com/vuejs/v2.vuejs.org/issues/2818

0๐Ÿ‘

You can review this config:

server {
    listen 80;
    listen [::]:80;

    root /var/www/html/frontend;
    index index.html;
    server_name your-domain.com www.your-domain.com;

    # X-Frame-Options is to prevent from clickJacking attack
    add_header X-Frame-Options SAMEORIGIN;

    # disable content-type sniffing on some browsers.
    add_header X-Content-Type-Options nosniff;

    # This header enables the Cross-site scripting (XSS) filter
    add_header X-XSS-Protection "1; mode=block";

    location / {
        root /var/www/html/frontend;
        try_files $uri /index.html;
    }
    
    location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg)$ {
        expires 1d;
    }
    
    error_log  /var/log/nginx/my-frontend.log;
}

Leave a comment