Nginx: Vue / Quasar in / route и laravel in / api route - PullRequest
0 голосов
/ 11 февраля 2019

На моем сайте brightmind-erp.com In не может заставить / api работать для маршрутов laravel.Структура такова:

public_html:

  • / dist (index.html с маршрутизацией Vuejs)
  • / core (проект laravel)

nginx config

include forge-conf/brightmind-erp.com/before/*;

server {
  listen 80;
  listen [::]:80;
  server_name .brightmind-erp.com;
  #root /home/forge/brightmind-erp.com/public;
  root /home/forge/brightmind-erp.com/dist;

 add_header X-Frame-Options "SAMEORIGIN";
 add_header X-XSS-Protection "1; mode=block";
 add_header X-Content-Type-Options "nosniff";

 index index.html index.htm index.php;

 charset utf-8;

 # FORGE CONFIG (DO NOT REMOVE!)
 include forge-conf/subdomain_a.mydomain.com.au/server/*;

 location / {
    try_files $uri $uri/ /index.html =404;
 }

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

 access_log off;
 error_log  /var/log/nginx/subdomain_a.mydomain.com.au-error.log error;

 error_page 404 /index.php;


 location /api {
    root /home/forge/brightmind-erp.com/core/public;
    try_files $uri $uri/ @laravel;
    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }
  }
  location @laravel {
    try_files /index.php =404;
  }
}

Вы можете войти и проверить эту проблему, также я не знаю, нужно ли мне устанавливать правила в .htacces папки dist, чтобы избежать маршрутизации в / api маршруты...

...