ubuntu + nginx + laravel vue-material-dashboard

89 views Asked by At

I tried a lot to get the "Vue-material-dashboard Laravel" working. Here is the url to the project. I manage to serve the thing, but when I try to login and it says: "Invalid credentials". Looks like this:
notification here

As you can see below I also send them a ticket ;) But have not gotten help from them yet, so I decided to see if someone can help me here

Version of Vue-material-dashboard Laravel

latest

Reproduction link

Nginx file:

server {
    listen 8080;
    
    index index.php index.html index.htm;

    server_name example.com;
    
    return 301 https://example.com$request_uri;

}

server {
    listen 443 ssl;

    server_name example.com;
    root /data/vue-material-dashboard-laravel/laravel-json-api/public;
    
    ssl_certificate /etc/nginx/ssl/cert.pem;
    ssl_certificate_key /etc/nginx/ssl/key.pem;    
    
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";

    index index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

   # location ~ /\.(?!well-known).* {
   #     deny all;
   # }
}

Operating System

Ubuntu

Device

server

Browser & Version

firefox, latest

Steps to reproduce

  1. I set all up according to documentation and run npm run build.
  2. I let nginx server the laravel/public folder. I use a rather minimal nginx configration in sites-enabled folder (see nginx code above)

What is expected?

I use the npm command, output tells me to look at http://example.com:8081 Everything looks fine and login should be working with default given login

What is actually happening?

I get some sort of backend, but cannot login. It says: "Invalid credentials"

Solution

Do you maybe have a nice example of how nginx should server the app? I could not find anything online. I tried running vue-material-dashboard over https by adding "vue.config.js":

module.exports = {
  devServer: {
    open: process.platform === 'darwin',
    host: '0.0.0.0',
    port: 8081, // CHANGE YOUR PORT HERE!
    https: true,
    hotOnly: false,
  },
}

Then indeed everything goes through https but login does still not work. Any ideas why? Seems api does not communicatie well with vue

Additional comments

If we can let it all work on a linux server we woudl want to go and buy the PRO version eventually (after we tested it and so on)

0

There are 0 answers