So... I'm trying to get 2 sites working from one nginx server. I've got the 2 following files (as parsed by nginx -T):
# configuration file /etc/nginx/conf.d/frontend.conf:
server {
listen 80;
listen [::]:80;
root /usr/share/nginx/html/frontend/dist;
index index.html index.htm;
server_name www.domain.com;
location / {
try_files $uri $uri/ =404;
}
}
# configuration file /etc/nginx/conf.d/backend.conf:
server {
listen 80;
listen [::]:80;
root /usr/share/nginx/html/backend/web;
index index.php
server_name api.domain.com;
location ~ \.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param HTTPS 'on';
if (-f $request_filename) {
fastcgi_pass 127.0.0.1:9000;
}
}
}
hitting www.domain.com bring up the frontend application, as built by node. This is correct.
hitting api.domain.com brings up the frontend application. This is where I get lost. Its a different domain, matching a different servername, shouldn't it (as such) hit the other folder, and more specifically get forwarded to the php-fpm?
I'm not even sure what else to look at now, or if you need more info. Any advice or pointers would be incredibly helpful.