[Vuejs]-Nginx configuration for a static Vue SPA and PHP app

0👍

If the config you have already works for you fine and only gives errors on POST requests, maybe you could just check if it’s POST?

server { 
  set $vue 0;

  root /var/www;
  index index.php index.html;

  location / {
     # Codeigniter
     try_files $uri $uri/ /index.php?/$request_uri;

     if( $uri = '' ) {
        set $vue 1;
     }
     if ($request_method = POST ) {
       set $vue 0; 
     }

     #Vue SPA
     if( $vue = 1 ) {
        root /var/www/path_to_spa/dist;
     }
  }
}

Untested, but I think you can make it work. Cheers!

Leave a comment