为api laravel + vue js配置nginx(找不到文件)

时间:2018-06-07 11:00:16

标签: laravel nginx vue.js

项目使用https://github.com/codecasts/spa-starter-kit

/ web /

中的/ webservice /,vue js中的laravel

我正在尝试在https://site.ru/api/route

设置API laraver

由于该站点位于https上,因此无法在server_ip发送请求到端口:8080(混合内容错误)

当您尝试访问api时,它会返回404并且文本“找不到文件”。请帮助,已经花了30个小时的清洁,不起作用

server {
server_name site.ru www.site.ru;
ssl on;
charset UTF-8;
index index.html index.php;

disable_symlinks if_not_owner from=$root_path;
access_log /var/www/httpd-logs/site.ru.access.log;
error_log /var/www/httpd-logs/site.ru.error.log notice;
set $root_path /var/www/www-root/data/www/site.ru/;

location / {
root /var/www/www-root/data/www/site.ru/client;

try_files $uri $uri/ /index.html;
}

location /api {
root /var/www/www-root/data/www/site.ru/webservice/public;

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

location ~\.php(.*) {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}

location ~ /\.ht {
deny all;
}

listen server_ip:443; 
}

fastcgi conf

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

日志

FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client:

0 个答案:

没有答案