Nginx:/路由中的Vue / Quasar和/ api路由中的laravel

时间:2019-02-11 18:56:37

标签: laravel nginx vue.js forge

在我的网站Brightmind-erp.com中,In无法使/ api对于laravel路由有效。 结构是这样的:

public_html:

  • / dist(带有Vuejs路由的index.html)
  • / core(laravel项目)

nginx配置

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;
  }
}

您可以输入并检查此问题,我也不知道是否必须在dist文件夹的.htacces中设置规则,以避免路由到/ api路由...

0 个答案:

没有答案