I have configured my Laravel API with Angular front-end in my Nginx server as the following. But the Laravel API is not working. Can you tell me what I'm doing wrong here.
This is the folder structure
www
-- my_domain
---- front-end index.html + css/js files + assets
---- api
------ index.php
------ public
-------- index.php
This is the nginx configuration I'm using
server {
listen 80;
server_name my_domain.com www.my_domain.com;
root /var/www/my_domain.com;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.html;
}
location /api {
alias /var/www/my_domain.com/api/public;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}