0

I have a REST API which is running fine in Nginx with this conf:

server {
    listen       443;
    server_name  localhost;

    ssl on;
    ssl_certificate /usr/local/etc/nginx/ssl/localhost.crt;
    ssl_certificate_key /usr/local/etc/nginx/ssl/localhost.key; 

    root /Volumes/Data/api/public/;

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

    location /index.php {
        fastcgi_connect_timeout 6000s;
        fastcgi_read_timeout 6000s;
        fastcgi_cache off;
        include   /usr/local/etc/nginx/conf.d/php-fpm;
    }
}

Now I want to make a Angular dashboard which doesn't go through my application's index.php. It is also not inside the root /public folder, but in a specific folder, which has a directory for the built/compiled angular project. I want it to be accessible on /dashboard.

location /dashboard {  
    root /Volumes/Data/api/dashboard/dist/;
    index index.html;
}

The problem is that it is looking for a folder named dashboard inside the new root: [error] 21783#0: *1 open() "/Volumes/Data/api/dashboard/dist/dashboard" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /dashboard HTTP/1.1", host: "localhost"

Is there a way to ignore the main location name (/dashboard) and start counting just after this name? Example:

/dashboard points to -> /Volumes/Data/api/dashboard/dist/
/dashboard/images points to ->  /Volumes/Data/api/dashboard/dist/images/
2

0

You must log in to answer this question.

Browse other questions tagged .