I have 2 folders dist and api_middleware in '/var/www/public_html/website.com/'
dist folder contains my frontend production code. This folder is symblink-ed from /home/user/frontend/dist
api_middleware folder contains codeignitor code, that we use as middleware for frontend to communicate with our erp. This folder is symblink-ed from /home/user/api_middleware.
I want to host both code with nginx. And this is the code that I came up with.
server { listen 443; ssl on; ssl_certificate /etc/ssl/website.com.crt; ssl_certificate_key /etc/ssl/website.com.key; server_name website.com; access_log /var/log/nginx/nginx.vhost.access.log; error_log /var/log/nginx/nginx.vhost.error.log; index index.php index.html index.htm index.nginx-debian.html; location / { root /var/www/public_html/website.com/dist; try_files $uri $uri/ /index.html; } location /api_middleware { root /var/www/public_html/website.com; try_files $uri $uri/ /api_middleware/index.php?/$request_uri; client_max_body_size 100M; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.2-fpm.sock; fastcgi_read_timeout 300; } } navigating to website.com works. But the api calls with website.com\api_middleware\<PARAMS> is returning a 404
What am I doing wrong?
PS. Using ubuntu 18.4.