【发布时间】:2019-10-01 12:15:51
【问题描述】:
所以我有两个目录。一个用于角度,一个用于 laravel。我正在尝试将它们部署在同一台服务器(LEMP 堆栈)上。
这是我的 nginx 配置文件:
server {
listen 80 default_server;
charset utf-8;
location / {
root /var/www/client/;
index index.html;
try_files $uri $uri/ /index.html;
}
location /api {
alias /var/www/server/public/;
index index.php;
try_files $uri $uri/ /index.php?$query_string;
}
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 ~ /\.(?!well-known).* {
deny all;
}
}
Angular 工作正常。该网站已显示,但当我向/api 提出请求时,我只是得到“未找到”。例如/api/register 不起作用。我做错了什么?
【问题讨论】: